Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


main()

{

char *p = “ayqm”;

printf(“%c”,++*(p++));

}

Answers were Sorted based on User's Feedback



main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / nithin

p has address of letter a. p++ means it will have address of
y. *p reffers to the character y. so pre-incrementing that
will result in letter z being printed.

Is This Answer Correct ?    19 Yes 18 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / minati sahoo

z

Is This Answer Correct ?    50 Yes 50 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / kishor amballi

char *p = "ayqm";

this line points to a string which is in read only data segment.

the printf statement p++ will be pointing to y.
It dumps core when trying to assign z at that location because the memory pointed to string ayqm is READ ONLY.

Is This Answer Correct ?    4 Yes 4 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / purushotham

baso

Is This Answer Correct ?    4 Yes 5 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / mr. c

Segmentation fault (core dumped)

Is This Answer Correct ?    6 Yes 8 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / hayat

compil time error

Is This Answer Correct ?    5 Yes 7 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / manoj gupta

function "printf" should have a prototype

Is This Answer Correct ?    4 Yes 6 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / govind verma

output will be error because p is a character pointer point to a constant string we cant modified it and in above program we try to modified at ++*(p++) ..so its lead to be error constatnt cant be modified......

Is This Answer Correct ?    0 Yes 2 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / mayank srivastava

printf("%c", p );-----> prints address of a, i.e. 1024 (say).
printf("%c", p++);-----> prints address of y, i.e. 1025 (say)
printf("%c", *(p++));-----> prints the char y,
printf("%c", ++*(p++));-----> prints the char z,

so final answer is z.

Is This Answer Correct ?    2 Yes 5 No

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }..

Answer / l.harish

infinite loop

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Code Interview Questions

Is it possible to print a name without using commas, double quotes,semi-colons?

7 Answers  


C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


can u give me the c codings for converting a string into the hexa decimal form......

1 Answers  


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

5 Answers   HCL,


void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }

1 Answers  


main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 Answers  


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 Answers  


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


Categories