Computer Science, asked by jansibanothu27, 1 day ago

What will be the output of the following program?
1 #include <stdio.h>
2 int main() {
3 char c[2]="I";
4 printf("\n%c",c[3]);
5 printf("\n%s", c);
6 }​

Answers

Answered by asura94
0

Answer:

line no. 4 will print a garbage value.

line no. 5 will print I

Explanation:

Since you haven't stored any value at c[3] you will get a random value which was stored at that memory location.

And since you are printing character array as string you will only get the value stored in the array.

Similar questions