Integer Input and Output

Integer I/O includes getw(), putw() functions. Those functions we are going to discuss in this blog. putw() This function is used to write any integer into a file. After writing any integer (or reading), the pointer will point to the next location. The syntax is written below. putw(<integer that we want to pass>,<file pointer name>);…

Character Input and Output

Character I/O includes getc(), putc(), fgetc(), fputc() functions. Those functions we are going to discuss in this blog. file pointer pointing any location Basically, the file pointer is a pointer to a structure and when it points to any location. It contains some information like file is being read/append/written, end of file reached or not,…

Usage of File

In this blog, we are going to learn how to make a file pointer and how to open and close a file using a file pointer. File pointer In each program where we are using file handling, we have to make a file pointer at the start of the program (before using any file operation)….

Introduction to File Data Type

Whatever programs we have done till now, those outputs were shown on screen. But that data was not stored in any secondary memory. This means those data were stored in primary memory, when we close the program then that data is permanently lost. We need some secondary memory storage to store data which is available…

malloc(), calloc(), realloc(), free()

Whichever memory that we have used till now was static memory. We can not change that memory while executing that program. But in some applications, we do not know how much memory we need. Let’s take an example to understand this. An array arr stores the roll number of students in class. Ex. int arr[50]; …

Pointer to Structure and Union

In this topic, we are going to learn the syntax and the use of pointers to structure and union. Pointer to structure and union is the same as a pointer to a simple variable. Working and purpose of structure and union will remain the same. When we want to store the address of a specific…

Pointer to Arrays

Pointer to array and array to a pointer, both are totally different things. In this section, we are going to understand the pointer to an array. Actually, the name of the character array (string), itself is a pointer. Below lines will print the address of str string. Ex1. char str[10]=”abcdef”;         printf(“%u”,str);  //%u…

Pointer as return type of function

When any function is returning an address then the return data type of that function must be a pointer. Because returning value is an address, to store an address we need a pointer. In short, to hold an address we need a pointer so the function which returns the address needs a pointer variable to…

Generic and Null Pointer

In this session, we are going to understand the meaning & use of a generic and NULL pointer. Generic pointer (void pointer) The generic pointer is also called void pointer also. With pointer declaration, we have to specify its data type also. That data type is the same as the data type of that variable,…

Multiple Indirections

Multiple indirections are called pointer of pointer or chain of pointer. So how to make a chain of pointer and how to use it is explained below. Here we will learn up to two levels of a pointer. For more levels, we need more indirection operators to use. Syntax of declaring pointer of pointer Syntax…