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
What is a structural principle?
What is the purpose of sprintf() function?
What are the different types of objects used in c?
Can we access the array using a pointer in c language?
Explain continue keyword in c
Explain how can you restore a redirected standard stream?
Can static variables be declared in a header file?
What are qualifiers and modifiers c?
In a switch statement, explain what will happen if a break statement is omitted?
Why c is called a mid level programming language?
What is the difference between exit() and _exit() function in c?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
How can I delete a file?
What functions are used in dynamic memory allocation in c?
Does free set pointer to null?