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

C Programming Concepts and Techniques

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 views3 pages

C Programming Concepts and Techniques

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 NOTES – DETAILED

UNIT I:

Overview of C Language Elements:

- Variable Declarations: Definition of variables, data types, syntax.

Example:

int a; float b;

- Executable Statements: Instructions executed by compiler.

Example:

printf("Hello");

- Arithmetic Expressions:

Example:

int c = a + b;

Selection Structures:

- if Statement:

if(a > b){ ... }

- if-else:

if(a>b) ... else ...

Looping:

- for Loop:

for(i=0;i<5;i++) printf("%d",i);

- while:

while(i<5) i++;

- do-while:

do { i++; } while(i<5);
UNIT II:

Functions:

- Definition:

A block of reusable code.

Example:

int add(int a,int b){ return a+b; }

Pointers:

int *p = &a;

Call by reference using pointers:

void swap(int *x,int *y){ int t=*x; *x=*y; *y=t; }

UNIT III:

Arrays:

int arr[5];

Looping through array:

for(i=0;i<5;i++) printf("%d",arr[i]);

Multidimensional arrays:

int a[2][3];

Strings:

char s[20]="Hello";

printf("%s",s);

String functions: strcpy, strlen, strcat.

UNIT IV:

Recursion:

Definition: Function calling itself.


Example:

int fact(int n){

if(n==1) return 1;

return n*fact(n-1);

Structures:

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

Unions:

union data { int x; float y; };

UNIT V:

File Handling:

FILE *fp;

fp=fopen("[Link]","r");

Binary files:

fread(), fwrite()

Searching & Sorting:

- Linear Search

- Binary Search

- Bubble Sort

- Insertion Sort

- Selection Sort

You might also like