ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
main()
{
        char *p1="Name";
        char *p2;
        p2=(char *)malloc(20);
        while(*p2++=*p1++);
        printf("%s\n",p2);
}
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }
Answer
# 1
error
 
Is This Answer Correct ?    0 Yes 0 No
Guest
 
  Re: main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }
Answer
# 2
the given program gives some meaningless output, with some 
modification to the given program as


#include<stdio.h>
#include<stdlib.h>
main()
{
	char a[]="ramesh";
        char *p1="Name";
        char *p2=a;
       
        while(*p2++=*p1++);/*copies  contents of p1 to 
p2*//* here it is not possible to use while(*a++=*p1++) 
because a can not change its value*/
		*p2='\0';
        printf("%s\n",a);
		
}

The output will be    Name
 
Is This Answer Correct ?    0 Yes 0 No
Subbu[iit Kgp]
 
 
 
  Re: main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }
Answer
# 3
i think above program ans ramesh
 
Is This Answer Correct ?    0 Yes 0 No
Friend
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the code for getting the output as * ** *** Caritor4
how to find that no is int or float?  4
IS STRUCTURES CAN BE USED WITHIN AN ARRAY? Caritor7
void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); } ME3
what are brk, sbrk? Oracle1
Write a program to accept a character & display its corrosponding ASCII value & vice versa?  3
printf("%d",(printf("Hello")); What it returns? TCS18
Sir i want e-notes of C languge of BAlaguruswami book i.e scanned or pdf file of balaguruswamy book on c language.PLEASE SEND ME on my mail id ajit_kolhe@rediff.com  2
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  4
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);} TCS8
read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x<MIN) x=-1; x=50; if the initial value of x=200,what is the vlaue after executing this code? a.200 b.1 c.-1 d.50 TCS2
biggest of two no's with out using if condition statement  2
how to find the binary of a number? Infosys5
What's wrong with "char *p = malloc(10);" ?  4
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?  2
what is the defrenece between structure and union  4
How can I read a directory in a C program?  1
long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes HCL10
What is the Difference between Macro and ordinary definition? Motorola2
Determine the code below, tell me exactly how many times is the operation sum++ performed ? for ( i = 0; i < 100; i++ ) for ( j = 100; j > 100 - i; j--) sum++; ITCO3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com