Find the output of the following C program: int main() { char str[10] = {0, 1,…
Find the output of the following C program:
int main()
{
char str[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
char *ptr;
int i;
ptr = str;
for (i = 0; i <= 9; i++)
{
if (*ptr)
{
printf("%c", *ptr);
ptr++;
}
}
return 0;
}
- A.
0123456789
- B.
0000000000
- C.
Compiler error
- D.
None of these
Attempted by 43 students.
Sign up free to check your answer
Sign up freeLoading lesson…

