Govt. Exams
Entrance Exams
All three methods are valid. Option A initializes with size 5, option B auto-determines size from initialization, and option C declares without initialization.
sizeof() is a unary operator that returns the number of bytes occupied by a variable or data type in memory.
The * operator is the dereference operator that accesses the value at a memory address. The & operator gets the address of a variable.
Both 'const int x = 10;' and 'int const x = 10;' are valid ways to declare constants in C. The const keyword can appear before or after the type.
stdio.h (Standard Input/Output header) contains declarations for printf(), scanf(), and other I/O functions.
The return statement is used to exit a function and return a value (if any) to the calling function. If the function has return type void, no value is returned.
In C, the 'const' keyword is used to declare constants. Once a const variable is initialized, its value cannot be changed. Options A, C, and D are not valid C syntax.
Variable 'a' is initialized to 10, 'b' is initialized to 20. When c = a + b, c becomes 10 + 20 = 30. Therefore, printf outputs 30.
In C, 'string' is not a primitive data type. C uses 'char' arrays to represent strings. The valid primitive data types are int, float, double, char, void, and their variants.
The break statement exits or terminates the current loop immediately. Option D describes continue (which skips to next iteration), while break actually exits the loop.