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
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
English,
21 hours ago
Social Sciences,
21 hours ago
English,
1 day ago
Social Sciences,
1 day ago
Math,
7 months ago
Social Sciences,
7 months ago