ALLInterview.com :: Home Page
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   Errors
   Testimonials Refer this Site  Refer This Site to Your Friends  Site Map  Contact Us      
   
 
Categories >> Software >> Programming Languages >> C
 


 

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



 Question Asked In Companies :: HCL, Ramco, Zycus Infotech, AMCAT,     < I also faced this Question! >
 Question Submitted By :: naveed
  Answer Posted By  
 
Answer
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 ?    5 Yes 4 No


 
  ali fakoor
 
View All Answers
 
 
Please Help Members By Posting Answers For Below Questions
 
 Question Views   Select
 
how to construct a simulator keeping the logical boolean gates in c 435
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions? 999
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation. 479
what are the 10 different models of writing an addition program in C language? 305
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file 877
how to write a bubble sort program without using temporary variable? 1981
develop algorithms to add polynomials (i) in one variable 394
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user? 782
what will be maximum number of comparisons when number of elements are given? 237
i got 75% in all semester am i eligible for your company 456
write a program in c language to print your bio-data on the screen by using functions. 3238
How to draw the flowchart for structure programs? 3089
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me 383
which type of aspect you want from the student. 480
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line. 1276
E-Mail New Answers        Answer Selected Questions