What will happen if in a c program you assign a value to an array element whose subscript exceeds the size of array?
Answers
Answered by
8
Answer:3)The program may crash if some important data gets overwritten.
Example consider the following program:
void main()
{
int a[10];
a[15]=65;
printf("%d",&a[15]);
}
when we compile this code we get some garbage value it just simply crash the values,based on the type of compiler the garbage value may vary.
Example consider the following program:
void main()
{
int a[10];
a[15]=65;
printf("%d",&a[15]);
}
when we compile this code we get some garbage value it just simply crash the values,based on the type of compiler the garbage value may vary.
Similar questions