main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
}
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
Is it possible to print a name without using commas, double quotes,semi-colons?
C statement to copy a string without using loop and library function..
can u give me the c codings for converting a string into the hexa decimal form......
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??
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
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
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); }
#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); }
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
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)); } }
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }