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

Write a procedure to implement highlight as a blinking operation

2 Answers  


#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }

3 Answers  


main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } } a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513

3 Answers   HCL, Logical Computers,


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 Answers  






How we will connect multiple client ? (without using fork,thread)

3 Answers   TelDNA,


print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!

11 Answers   Wipro,


main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }

2 Answers  


Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


What are segment and offset addresses?

2 Answers   Infosys,


#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 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  


Categories