Govt. Exams
Entrance Exams
In C, pointers are declared using the asterisk (*) symbol before the variable name. The syntax is 'datatype *pointer_name;'
int x = 5;
printf("%d", x++);
The post-increment operator (x++) returns the current value of x before incrementing. So printf prints 5, and then x becomes 6.
A Stack follows LIFO principle where the last element inserted is the first one to be removed.
It is fundamental in managing function calls through the call stack, undo/redo operations, and expression evaluation.
Queues use FIFO, Heaps are used for priority ordering, and Linked Lists maintain sequential but flexible storage.
The answer is correct because it accurately captures the fundamental distinction between these two memory allocation functions in C. malloc() allocates a block of uninitialized memory and requires only the total number of bytes as a single argument, while calloc() allocates memory for an array of elements, takes two arguments (number of elements and size per element), and crucially initializes all allocated memory to zero. This initialization feature of calloc() is a key advantage when you need guaranteed zero values, whereas malloc() leaves memory with whatever garbage values were previously there. Other options would be incorrect if they claimed malloc() initializes memory, if they stated calloc() takes only one argument, or if they reversed which function initializes to zero.