main()

{

char *p = “ayqm”;

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

}

Answers were Sorted based on User's Feedback



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

Answer / susie

Answer :

b

Is This Answer Correct ?    155 Yes 26 No

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

Answer / kirit vaghela

p is char pointer that store the address of string "ayqm"
that means p have the address of 'a'.
if we write printf("%c",*p);
we get the output 'a';
now the *(p++) is post-increment that means it print the
value than increment the address by 1.
so *(p++) is print the value 'a'.
at finally ++*(p++) is increment the ascii value of 'a' by 1.
so it become 'b'.
the final output is 'b'.

Is This Answer Correct ?    88 Yes 6 No

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

Answer / sanjay

b

Is This Answer Correct ?    24 Yes 3 No

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

Answer / vikas patel

b

Is This Answer Correct ?    25 Yes 13 No

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

Answer / vikas mathur

correct answer is :- b
why because
p is a char pointer that holds the base address of
string"ayqm". so p points to address where 'a' is stored.
p++ is a post increnment statement so p will still points
to a but after this printf statement p will start pointing
to 'y'.
now *(p++) will return the values at address pointed by p
which is 'a'. and ++*(p++) means ++'a' which returns 'b'
so correct answer is b

Is This Answer Correct ?    13 Yes 3 No

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

Answer / anu-priya

the answer is b..
char *p="ayqm"; p a character pointer points to the base add
of string ie a...
printf("%c",*p); will print a....
printf("%c",*(p++)); will print a....
when we post increment the p then it will giv answer a..but
it wil increment by 1
printf("%c",++*(p++));
here it is ++a will print b....

Is This Answer Correct ?    9 Yes 4 No

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

Answer / ana

b

Is This Answer Correct ?    10 Yes 6 No

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

Answer / mukesh yadav

b

Is This Answer Correct ?    5 Yes 1 No

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

Answer / sumesh

the output of given problem will be :- b .
because %c in the printf function will take only one word of *p.and then its increasing one value by ++.

Is This Answer Correct ?    3 Yes 0 No

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

Answer / leka

b

Is This Answer Correct ?    4 Yes 2 No

Post New Answer

More C Code Interview Questions

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }

1 Answers  


what is brs test reply me email me kashifabbas514@gmail.com

0 Answers  


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,






main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


All the combinations of prime numbers whose sum gives 32

1 Answers   HHH,


#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


Question: We would like to design and implement a programming solution to the reader-writer problem using semaphores in C language under UNIX. We assume that we have three readers and two writers processes that would run concurrently. A writer is to update (write) into one memory location (let’s say a variable of type integer named temp initialized to 0). In the other hand, a reader is to read the content of temp and display its content on the screen in a formatted output. One writer can access the shared data exclusively without the presence of other writer or any reader, whereas, a reader may access the shared memory for reading with the presence of other readers (but not writers).

1 Answers  


Categories