Advanced C Pointer Programming chapter 5: Pointers and Arrays.

Before we understand the relationship between pointers and arrays, let us see some basic examples of arrays. Statically allocated arrays The size of the array known at compile time is called as statically allocated arrays. The memory will be given in the program stack. They are stored in contiguous memory locations. Hence you can do […]

Advanced C Pointer Programming chapter 4: Function pointers.

A function pointer is a pointer that holds the memory address of a function. How to declare a function pointer in C? Consider the function prototype as below: void sum (); According to the above function prototype, the function sum will not take any arguments, and will not return anything. So we can declare a […]

Advanced C Pointer Programming chapter 3: Pointers and Dynamic Memory Management.

Dynamic Memory Management Introduction. C provides a way to allocate memory at runtime. This is done with the help of DMM. This is a very important feature in C language, and yet programmers seldom makes mistake while writing a program resulting in program crash. Different types of Dynamic Memory Allocation functions There are 3 different […]

Advanced C Pointer Programming chapter 2: Pointer Arithmetic

Introduction: Operations that can be performed on Addresses: WKT pointer variable will hold the address of another variable. i.e int a = 10; int *ptr = NULL; ptr = &a; Now, If you print “ptr”, it will print the value that is stored inside it. i.e the address of variable a. If you print “*ptr”, […]

Advanced C Pointer Programming chapter 1: Introduction to pointers

Pointers in C is a very interesting topic if understand correctly. Hence in this series of Advanced C Pointer Programming tutorial I shall make you understand pointer in a simple and easy. The only prerequisite is that you should be knowing the basic syntax of C programming. In each chapter beginning I shall be giving […]

C Language Dynamic Memory Allocation.

In this lesson we shall study about following topics 1. Introduction 2. Malloc 3. Calloc 4. Re-alloc 5. Free 1. Introduction  In C program there are 2 ways to allocate memory. 1. Compile time memory allocation: We use this type of allocation when we know the size of elements that we are storing before execution […]

C language file operations

In this chapter we shall study about below topics: 1. Introduction 2. Common file functions 3. Basic file operation functions 4. File open modes 5. Binary Modes 6. File Input and Output operations 1. Introduction A file is a sequence of bytes that are stored in the secondary memory. There are various kinds of files, […]

C language Pre-Processor Directives

1. #define directive 2. Undefined a Macro 3. Token pasting and stringizing Operators 4. #include directive 5. Conditional Compilation 6. #ifndef Directive 7. #error Directive 8. #pragma Directive 9. Assertions in C 10. Predefined macros in C 1. #define directive The #define is a pre-processor directive is used to define a macro. A macro can […]

C Language Storage Classes

Storage classes are used to know the scope and lifetime of a variable. There are 2 types of storage classes. 1. Local 2. Global Below are different storage class specifiers: 1. auto 2. register 3. static 4. extern Before looking into storage classes, we shall discuss about variables and how they behave in different blocks. […]

C language Input and Output

C language Input and output can be classified into 2 types: 1. Formatted I/O a. printf () b. scanf() 2. Un-Formatted I/O a. getch() b. putch() c. getchar() d. putchar() e. gets() f. puts() 3. Escape sequence 4. Format Specifiers 1. Formatted I/O: Formatted functions allow us to display the results according to our requirements. […]