C | String | Question 13

filter_none

edit
close

play_arrow

link
brightness_4
code

int main()
{
    char p[] = "geeksquiz";
    char t;
    int i, j;
    for(i=0,j=strlen(p); i<j; i++)
    {
        t = p[i];
        p[i] = p[j-i];
        p[j-i] = t;
    }
    printf("%s", p);
    return 0;
}

chevron_right


Output?
(A) ziuqskeeg
(B) Nothing is printed on the screen
(C) geeksquiz

(D) gggggggg


Answer: (B)

Explanation: The string termination character ‘\0’ is assigned to first element of array p[]

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.