Open In App

C | String | Question 13

Like Article
Like
Save
Share
Report

C




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


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
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads