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
Biology,
1 month ago
Social Sciences,
1 month ago
Sociology,
1 month ago
English,
2 months ago
Social Sciences,
2 months ago
Math,
9 months ago
Social Sciences,
9 months ago