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

C Programming Notes

The document provides detailed notes on C programming, covering five units: basics, control structures, arrays and structures, functions, and pointers. It includes definitions, examples, and explanations of algorithms, program structure, data types, control statements, arrays, functions, and pointers. Key concepts such as recursion, library functions, and pointer arithmetic are also highlighted.

Uploaded by

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

C Programming Notes

The document provides detailed notes on C programming, covering five units: basics, control structures, arrays and structures, functions, and pointers. It includes definitions, examples, and explanations of algorithms, program structure, data types, control statements, arrays, functions, and pointers. Key concepts such as recursion, library functions, and pointer arithmetic are also highlighted.

Uploaded by

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

C Programming Detailed Notes (Unit I–V)

Unit I: Basics of C Programming

1.1 Algorithm: An algorithm is a step-by-step procedure to solve a problem. It must be finite,


unambiguous, and effective.

Example: Algorithm to add two numbers: Step1: Start Step2: Input a,b Step3: sum=a+b Step4: Print
sum Step5: Stop

1.2 Structure of C Program:

#include → Header file int main(){ printf("Hello"); return 0;}

Tokens: Smallest units like keywords, identifiers, constants, operators.

Data Types: int, float, char, double. Example: int a=10;

Input/Output:

printf() → output, scanf() → input. Example: scanf("%d", &a;);

Operators: Arithmetic(+,-), Logical(&&), Bitwise(&), sizeof operator.

Unit II: Control Structures

If statement: if(condition){ statements }

Switch: switch(var){ case 1: break; }

Loops:

for(i=0;i<5;i++){} while(condition){} do{}while();

Break & Continue: break exits loop, continue skips iteration.

Unit III: Arrays & Structures

Array: Collection of same type elements. Example: int a[5];

2D Array: int a[2][2];

String: char str[10]; gets(), puts()

Structure: struct student{int id; char name[20];};

Unit IV: Functions

Function: Block of code. Example: int add(int a,int b){return a+b;}

Library Functions: sqrt(), strlen(), malloc()

Recursion: Function calling itself.

Unit V: Pointers

Pointer: Variable storing address. Example: int *p;

Operators: & gives address, * gives value.


Pointer Arithmetic: p++ increments address.

Pointer to Structure: struct student *ptr; ptr->id

You might also like