Govt. Exams
Entrance Exams
strlen() counts characters excluding the null terminator. "Hello" has 5 characters, so strlen(s) returns 5.
An empty structure in C has a size of 1 byte. This is to ensure each structure instance has a unique address in memory.
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.