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

why java is platform independent?

13 Answers   Wipro,


main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,


main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error

1 Answers   HCL,


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

29 Answers   IBM, TCS, UGC NET, Wipro,


Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  






void pascal f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } void cdecl f(int i,int j,int k) { printf(“%d %d %d”,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }

1 Answers  


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  


why the range of an unsigned integer is double almost than the signed integer.

1 Answers  


void main() { int i=5; printf("%d",i+++++i); }

3 Answers  


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

0 Answers   Home,


Categories