Govt Exams
In structures, each member has its own memory location. In unions, all members share the same memory location, so only one can hold a value at a time.
Since both 5 and 2 are integers, integer division occurs (5/2 = 2). The result 2 is then converted to float as 2.000000.
/* */ is used for multi-line comments in C. // is used for single-line comments and was introduced in C99.
calloc(n, size) allocates n blocks of size bytes and initializes to 0. malloc(size) allocates size bytes without initialization. calloc() is typically slower due to initialization.
The free() function deallocates memory that was previously allocated using malloc(), calloc(), or realloc(). delete() is used in C++.
malloc() returns a void pointer (void*) which can be cast to any pointer type. It returns NULL if memory allocation fails.
x=5 is greater than 3, so the condition (x > 3) evaluates to true. The if block executes, printing 'Greater'.
In C, void function() { } is correct. In some contexts, void function(void) { } is more explicit. Options B and C use invalid keywords for this purpose.
Loop runs with i=0,1,2. When i=3, condition i<3 becomes false and loop terminates. Output: 0 1 2 (with spaces).
scanf() reads formatted input from the standard input device (usually keyboard). printf() displays output. Both require #include <stdio.h>.