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 is void pointers in c?
What is clrscr in c?
Explain what are the standard predefined macros?
What is c programing language?
Can true be a variable name in c?
Explain a pre-processor and its advantages.
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is void main () in c?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
What are the scope of static variables?
Which is better between malloc and calloc?
Explain enumerated types in c language?
What are global variables and how do you declare them?
Explain what does the format %10.2 mean when included in a printf statement?
Do pointers store the address of value or the actual value of a variable?