printf(5 + "good morning");

"good morning" is a character array.

If we assume base address of the character array "good morning" as 1024.

The starting address points to the character 'g'.




5 + "good morning" or "good morning" + 5

5 + "good morning" will be (base address + 5 which is 1029.(size of character is 1 byte.)

Now the starting address is 1029 which points the character 'm'.


5 + good morning

printf will print the given message from the starting address to the end.

Here, starting address has changed to 1029.

So, it will print "morning"


#include<stdio.h>

int main()
{
    printf(5 + "good morning");

    return 0;
}

Output

morning


Topics You Might Like