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
 
pierrot's divisor program using c or c++ code 647
a c code by using memory allocation for add ,multiply of sprase matrixes 1022
How to delete a node from linked list w/o using collectons? 823
Which is the best sort method for library management? 561
while initialization of array why we use a[][2] why not a[2][]...? 691
Write a C program to count the number of email on text 420
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE. 829
difference between object file and executable file 1727
Explain the process of converting a Tree into a Binary Tree. 643
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive. 380
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ? 1576
main() { FILE *fs; char c[10]; fs = fopen(“source.txt”, ”r”); /* source.txt exists and contains “Vector Institute” */ fseek(fs,0,SEEK_END); fseek(fs,-3L,SEEK_CUR); fgets(c,5,fs); puts(c); } 1517
how do you programme Carrier Sense Multiple Access 468
the question is that what you have been doing all these periods (one year gap) 574
Stimulate calculator using Switch-case-default statement for two numbers 1296
E-Mail New Answers        Answer Selected Questions