main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?
Answer Posted / vint
int main()
{
char *p1="Name";
char *p2,*s1,*s2;;
p2=(char *)malloc(20);
s1 = p1;
s2 = p2;
while(*p2++ = *p1++);
printf("%s %s",s1,s2);
return 0;
}
Store the Start address of p1 and p2 before incrementing the pointer so that it could be later used to print the String.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
Function calling procedures? and their differences? Why should one go for Call by Reference?
Explain what is the most efficient way to store flag values?
Explain 'bus error'?
Whats s or c mean?
Explain what is the benefit of using an enum rather than a #define constant?
When can you use a pointer with a function?
In C language, a variable name cannot contain?
What type is sizeof?
What is static volatile in c?
What are multibyte characters?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What is the advantage of an array over individual variables?
What is an auto variable in c?
How would you rename a function in C?