What is the output of the following C program? (Assume appropriate Header Files will be added)
main()
{
char *p;
char str[] = "Get set go!";
p = str;
p += 4;
printf("%s",p);
return 0;
}
Get set go!
set go!
No output
Answers
Answered by
0
Yug class 5F Present mam hindi
Answered by
0
Answer:
Appropriate header fill which will be added is:
#include<stdio.h>
Output:
set go!
Explanation:
p = str;
p points to the address of "Get set go!" which is stored somewhere in the memory.
Assume,
G e t s e t g o !
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
So, p = 2000
p += 4;
Now p will change
p = p + 4 = 2000 + 4 = 2004
Now, p will point to the address 2004.
So, output will be "set go!"
Similar questions