Govt. Exams
Entrance Exams
#include
int main() {
int arr[] = {10, 20, 30};
printf("%d", *(arr + 1));
return 0;
}
arr + 1 points to the second element. Dereferencing with * gives the value 20.
The 'const' keyword creates a constant variable that cannot be modified after initialization. The compiler enforces this at compile time.
\t is the escape sequence for a tab character. \n is for newline, \s is invalid in C.
The main() function is the entry point where program execution begins. Every C program must have a main() function.
Following operator precedence, multiplication (*) has higher precedence than addition (+). So 3*2=6, then 5+6=11.
#include
int main() {
int x = 5;
printf("%d", x++);
return 0;
}
x++ is post-increment. The value 5 is printed first, then x is incremented to 6.
In C, variable declaration requires a semicolon at the end. The syntax is 'data_type variable_name;'