Govt. Exams
Entrance Exams
sizeof(int) * 10 = 4 * 10 = 40 bytes on a 32-bit system.
free() is the standard function to deallocate memory previously allocated by malloc(), calloc(), or realloc().
calloc() takes two arguments (number of elements and size) and initializes all allocated bytes to zero, unlike malloc().
The <stdlib.h> header file contains declarations for malloc(), calloc(), realloc(), and free() functions.
'w' opens file in text mode (converts line endings), while 'wb' opens in binary mode (no conversion). This matters when handling platform-specific line endings (\r\n vs \n).
feof() is the standard C library function that returns non-zero if EOF has been reached on the given file stream. Other options are not valid C functions.
'w' mode opens file in text format for writing. 'wb' is binary write. 'wt' is explicitly text write but 'w' is default text mode.
ftell() returns the current file position as a long integer. fgetpos() stores position in a fpos_t structure. rewind() resets to beginning.
SEEK_END moves the file pointer to the end of file. SEEK_SET goes to beginning, SEEK_CUR to current position.
Mode 'r+' opens file for reading and writing without truncating. 'w+' truncates the file, 'a+' appends, and 'x+' is for exclusive creation.