Consider the following C program segment. #include <stdio.h> int main() { char…

GATE · 2015 · CS · Set 3 · Computer Science & IT

Consider the following C program segment.

#include <stdio.h>

int main()
{
    char s1[7] = "1234", *p;
    p = s1 + 2;
    *p = '0';
    printf("%s", s1);
}

What will be printed by the program?

  1. A.

    12

  2. B.

    120400

  3. C.

    1204

  4. D.

    1034

Attempted by 497 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…