main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
Answer Posted / subbu[iit kgp]
the given program gives some meaningless output, with some
modification to the given program as
#include<stdio.h>
#include<stdlib.h>
main()
{
char a[]="ramesh";
char *p1="Name";
char *p2=a;
while(*p2++=*p1++);/*copies contents of p1 to
p2*//* here it is not possible to use while(*a++=*p1++)
because a can not change its value*/
*p2='\0';
printf("%s\n",a);
}
The output will be Name
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the advantages of using macro in c language?
Where in memory are my variables stored?
Explain what is the difference between null and nul?
What is your stream meaning?
What is the difference between malloc calloc and realloc in c?
What is the use of linkage in c language?
What is the explanation for prototype function in c?
Compare interpreters and compilers.
Why dont c comments nest?
Is fortran still used in 2018?
Explain how do you view the path?
Explain high-order bytes.
How many levels deep can include files be nested?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
Explain why C language is procedural?