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
 
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos. 451
A marketing company wishes to construct a decision table to decide how to treat clients according to three characteristics: Gender, City Dweller, and age group: A (under 30), B (between 30 and 60), C (over 60). The company has four products (W, X, Y and Z) to test market. Product W will appeal to female city dwellers. Product X will appeal to young females. Product Y will appeal to Male middle aged shoppers who do not live in cities. Product Z will appeal to all but older females. 298
what do u mean by Direct access files? then can u explain about Direct Access Files? 596
how to write optimum code to divide a 50 digit number with a 25 digit number?? 1532
hi, which software companys will take,if d candidate's % is jst 55%? 536
the question is that what you have been doing all these periods (one year gap) 613
HOW TO SOLVE A NUMERICAL OF LRU IN OS ?????? 1152
How to delete a node from linked list w/o using collectons? 894
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com 240
writ a program to compare using strcmp VIVA and viva with its output. 408
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ? 519
provide an example of the Group by clause, when would you use this clause 576
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given 85
write a program to rearrange the array such way that all even elements should come first and next come odd 508
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record 2454
E-Mail New Answers        Answer Selected Questions