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;

}

  1. A.

    0123456789

  2. B.

    0000000000

  3. C.

    Compiler error

  4. D.

    None of these

Attempted by 43 students.

Sign up free to check your answer

Sign up free

Explore the full course: Isro

Loading lesson…