C Language MCQ - English
What will happen if in a C program you assign a value to an array element whose
Home | Discussion ForumWhat will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
Answer : C
View More Related Question
1) In C, if you pass an array as an argument to a function, what actually gets passed?
Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
View Answer
2) What will be the output of the following code?
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
3) What is the maximum number of dimensions an array in C may have?
4) What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
View Answer
5) What will be the output of the program ?
#include <stdio.h>
int main()
{
int arr[1] = {10};
printf("%d", 0[arr]);
return 0;
}