find the output of the following program
main()
{
int x=5, *p;
p=&x;
printf("%d",++*p);
}
Answers were Sorted based on User's Feedback
Answer / rahul khare
6
becoz it(++*p) will evaluate like this-
1)
*(p)- gives value at this address that is 5
2)
now increment ++5
that is 6.
| Is This Answer Correct ? | 37 Yes | 1 No |
Answer / vignesh1988i
the answer is 6...since ++ as well as * gets the same
prority so the associativity will be right to left.. so it
will point to the value and then increment the value
| Is This Answer Correct ? | 23 Yes | 3 No |
Answer / manishsoni
main()
{
int x=5, *p;
p=&x;
printf("%d",++*p);
}
it allocate as this
____ _____
x| |value p | | store &x
| 5 | | 100 |
|____| |_____|
____ _____
|100 |&x | 200 |&p p is pointer //at statement ++*p
|____| |_____|
^ ^
|________________|
and jumpt at 5 bcoz it is prefix for firstof all 5 is
increase then print
| Is This Answer Correct ? | 7 Yes | 2 No |
Write a C program to check a number even or odd, without using any relational, arithmetic operator and any loops.
Why we not create function inside function.
What are the rules for identifiers in c?
int far *near * p; means
What is main function in c?
What does %p mean?
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); }
Is sizeof a keyword in c?
What is difference between union All statement and Union?
What is the deal on sprintf_s return value?
what is difference between strcmp & palindrome?
State the difference between x3 and x[3].