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

Advanced C Programming Notes

The document provides topic-wise notes on Advanced C Programming, covering key concepts such as arrays, pointers, strings, structures, unions, preprocessor directives, bitwise operators, and file handling. Each unit includes definitions, examples, and functions relevant to the topics. The notes serve as a comprehensive guide for understanding advanced features of the C programming language.

Uploaded by

Anshul
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)
764 views2 pages

Advanced C Programming Notes

The document provides topic-wise notes on Advanced C Programming, covering key concepts such as arrays, pointers, strings, structures, unions, preprocessor directives, bitwise operators, and file handling. Each unit includes definitions, examples, and functions relevant to the topics. The notes serve as a comprehensive guide for understanding advanced features of the C programming language.

Uploaded by

Anshul
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
You are on page 1/ 2

Advanced C Programming - Topic-wise Notes

UNIT-I: Arrays

- Arrays are collections of elements of the same data type stored in contiguous memory locations.

- One-dimensional arrays: int arr[10];

- Two-dimensional arrays: int matrix[3][3];

- Accessing elements: arr[0], matrix[1][2];

- Array initialization: int arr[] = {1, 2, 3};

- Sorting: Bubble sort, Selection sort etc.

- Arrays and functions: Passing arrays to functions using pointers.

- Memory representation: Row-major (C style) and column-major.

UNIT-II: Pointers

- Pointer: A variable that stores the address of another variable.

- Declaration: int *p;

- Initialization: int a = 10; p = &a;

- Indirection operator (*), Address-of operator (&)

- Pointer arithmetic: p++, p--, p+n

- Dynamic memory allocation: malloc(), calloc(), free()

- Pointers and arrays: int *p = arr;

UNIT-III: Strings

- Strings are arrays of characters ending with null character '\0'.

- Declaration: char str[20] = "Hello";

- Initialization: char str[] = {'H','e','l','l','o','\0'};

- Functions: strlen(), strcpy(), strcat(), strcmp()

- Manual implementation using loops.

UNIT-IV: Structures and Unions


Advanced C Programming - Topic-wise Notes

- Structures: Group of variables of different types.

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

- Access fields using dot operator: s1.id

- Nested structures: struct dept {struct student s; int code;};

- Union: Similar to structure but shares memory.

- Difference: Structure allocates memory for all members, Union for largest one.

UNIT-V: Preprocessor and Bitwise Operators

- Preprocessor: Handles directives before compilation.

- Macro: #define PI 3.14

- File inclusion: #include <stdio.h>

- Conditional compilation: #ifdef, #ifndef, #endif

- Bitwise operators: &, |, ^, ~, <<, >>

- Bit fields and masks: Used to access specific bits.

UNIT-VI: File Handling

- File: Collection of data stored on disk.

- Opening: FILE *fp = fopen("data.txt", "r");

- Closing: fclose(fp);

- Functions: fgetc(), fputc(), fprintf(), fscanf()

- Random access: fseek(), ftell(), rewind()

- Command line arguments: main(int argc, char *argv[])

You might also like