main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?



Answer Posted / ali fakoor

A part of uninitialized (and/or unowned) memory after (and
including) the sixth byte of the malloc-ed memory will be
printed out until reaching a NULL character in the memory
somewhere!

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

in iso what are the common technological language?

1631


Why we use void main in c?

590


What is the deal on sprintf_s return value?

639


What is the general form of #line preprocessor?

581


In a switch statement, explain what will happen if a break statement is omitted?

632






a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

627


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

632


What is a example of a variable?

551


Explain function?

660


Write a program to swap two numbers without using the third variable?

591


Write a code to generate divisors of an integer?

634


What is a good way to implement complex numbers in c?

589


How to write a multi-statement macro?

616


Explain how can I avoid the abort, retry, fail messages?

585


What is getch c?

847