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 |
How does free() know how many bytes to free?
how to add two numbers without using arithmetic operators?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
What is the difference between struct and typedef struct in c?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What is the difference between NULL and NUL?
Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .
write a own function to compare two strings with out using stringcomparition function?
how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.
What are reserved words with a programming language?
Find the O/p of the following 1) #include int main() { char c='1'; int j=atoi(c); }
What is the meaning of this decleration? unsigned char (*pArray[10][10]); please reply.