main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
}
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above
void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
Is the following code legal? typedef struct a { int x; aType *b; }aType
What is the main difference between STRUCTURE and UNION?
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }
write a c-program to find gcd using recursive functions
main() { int i=5,j=6,z; printf("%d",i+++j); }
Write a program to print a square of size 5 by using the character S.
int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().
program to find the roots of a quadratic equation
14 Answers College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,