Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. Consider the following C program segment.
    #include
    int main()
    {
        char sl[7] = “1234”, *p;
       p = sl + 2;
       *p = ‘0’;
       printf (“%s”, s1);
    }
    What will be printed by the program?
    1. 12
    2. 120400
    3. 1204
    4. 1034
Correct Option: C


After *P = '0', array will become

and we are pointing string S which is 1204.



Your comments will be displayed only after manual approval.