0% found this document useful (0 votes)
24 views2 pages

C Programming Basics for BSc CS Students

The document provides an overview of the C programming language, covering its introduction, structure, data types, variables, constants, operators, control statements, functions, arrays, strings, pointers, structures, and file handling. It highlights C's characteristics such as being fast, efficient, and portable, and includes examples for various concepts. The notes serve as a foundational guide for first-year BSc Computer Science students learning programming in C.

Uploaded by

Animesh salunkhe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

C Programming Basics for BSc CS Students

The document provides an overview of the C programming language, covering its introduction, structure, data types, variables, constants, operators, control statements, functions, arrays, strings, pointers, structures, and file handling. It highlights C's characteristics such as being fast, efficient, and portable, and includes examples for various concepts. The notes serve as a foundational guide for first-year BSc Computer Science students learning programming in C.

Uploaded by

Animesh salunkhe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

PROGRAMMING IN C – NOTES (BSc CS 1st Year)

1) INTRODUCTION TO C

- C is a procedural, structured, general–purpose programming language.


- Developed by Dennis Ritchie in 1972 at Bell Labs.
- Used in system software, operating systems, embedded systems.

Characteristics: - Fast and efficient - Portable - Middle-level


language - Rich library support

2) STRUCTURE OF A C PROGRAM Basic structure: #include <stdio.h>

int main() { // statements return 0; }

Parts: - Header files - Main function - Body of program - Return


statement

3) DATA TYPES IN C Primary Data Types:

- int
- float
- char
- double

Derived Data Types: - arrays - pointers - structures - unions

4) VARIABLES AND CONSTANTS Variable: A name given to a memory location.


Example: int age;

Constants: Types: - Integer constant - Float constant - Character


constant - String constant

5) OPERATORS IN C Arithmetic: + - * / % Relational: > < >= <= == !=


Logical: && || ! Assignment: = += -= Increment/Decrement: ++ –

6) CONTROL STATEMENTS Conditional:

- if
- if-else
- else-if ladder
- switch

Looping: - for - while - do…while

Jump statements: - break - continue - goto

7) FUNCTIONS Function syntax: return_type function_name(parameters) {


// code }

Types: - Built-in functions - User-defined functions

Call by Value vs Call by Reference

8) ARRAYS Definition: Collection of similar data items.

1D Array Example: int a[5];

2D Array Example: int matrix[3][3];


9) STRINGS String = array of characters. Example: char name[20] =
“Computer”;

Common functions: strlen(), strcpy(), strcat(), strcmp()

10) POINTERS Pointer: Variable that stores address of another variable.


Example: int *ptr; ptr = &x;

Pointer arithmetic: ptr++ ptr–

11) STRUCTURES Used to store different data types together. Example:


struct student { int id; char name[20]; float marks; };

12) FILE HANDLING Main functions:

- fopen()
- fclose()
- fprintf()
- fscanf()
- fgetc()
- fputc()

Modes: r – read w – write a – append r+ / w+ / a+

END OF NOTES

You might also like