TCS Company Programming Arrays

What will happen if in a C program you assign a value to an array element
whose subscript exceeds the size of array?
1. The element will be set to 0.
2. The compiler would report an error.
3. The program may crash if some important data gets overwritten.
4. The array size would appropriately grow.

Read Solution (Total 11)

TCS Other Question

Comment on the below while statement=while (0 == 0) { }
A) It has syntax error as there are no statements within braces {}
B) It will run forever
C) It compares 0 with 0 and since they are equal it will exit the loop immediately
D) It has syntax error as the same number is being compared with itself
What does the following declaration mean?
int (*ptr)[10];
1.ptr is array of pointers to 10 integers
2.ptr is a pointer to an array of 10 integers
3.ptr is an array of 10 integers
4.ptr is an pointer to array