Govt Exams
When %d format specifier is used with a char variable, it prints the ASCII value. The ASCII value of 'A' is 65. If it were 'a', the value would be 97.
The correct syntax for declaring a pointer to an integer is 'int *ptr;' where the asterisk (*) indicates that ptr is a pointer. The placement of * before the variable name is crucial.
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.
Parentheses have the highest precedence in C. Expressions within parentheses are evaluated first, followed by arithmetic operators, then logical operators, and finally assignment operators.
The stdio.h (Standard Input Output) header file contains declarations for printf(), scanf(), and other input/output functions. It is essential for console I/O operations.
In a 32-bit system, the int data type typically occupies 4 bytes (32 bits). This is the standard size for integer types on most 32-bit architectures.
Both char s[] (array notation) and char *s (pointer notation) are valid ways to pass strings to functions in C. C does not have a built-in string type; strings are represented as character arrays or pointers to char.
x++ is post-increment. First printf uses current value (10), then x is incremented. Second printf uses new value (11). Output: 1011
C does not perform bounds checking on arrays. Accessing beyond array bounds results in undefined behavior - it may access garbage values, crash, or seem to work without error. This is a common source of bugs.
for(int i = 1; i
When i = 1, it prints 1. When i = 2, continue skips the printf() and moves to the next iteration. When i = 3, it prints 3. Output: 1 3