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 null pointer assignment error? What are bus errors, memory faults, and core dumps?
Differentiate between static and dynamic modeling.
What is 2 d array in c?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
How we can insert comments in a c program?
How many identifiers are there in c?
How can I list all of the predefined identifiers?
What is the symbol indicated the c-preprocessor?
Who is the main contributor in designing the c language after dennis ritchie?
What's the difference between constant char *p and char * constant p?
hi, which software companys will take,if d candidate's % is jst 55%?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
Explain what is a const pointer?
What is mean by data types in c?
What is bubble sort in c?