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 are the rules for the identifier?
Explain how can I make sure that my program is the only one accessing a file?
What is difference between function overloading and operator overloading?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
What is a protocol in c?
Explain what is gets() function?
Can we use visual studio for c?
Is linux written in c?
Explain what is a program flowchart and explain how does it help in writing a program?
What is New modifiers?
What is the function of this pointer?
What are pragmas and what are they good for?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
write a c program to calculate sum of digits till it reduces to a single digit using recursion