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
When is a void pointer used?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
What is difference between structure and union in c programming?
Is return a keyword in c?
What is a ternary operator in c?
What is omp_num_threads?
What are the 32 keywords in c?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
please explain every phase in the "SDLC" in the dotnet.
What is a program flowchart and explain how does it help in writing a program?
What is the use of the function in c?
What is break statement?
What is ponter?
What does stand for?