Welcome Guest | Sign in | Register
Structures - Discussion Page For Q.10503 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Structures > Questions and Answers

Q: What is the output of this program?
struct point
{
int x;
int y;
};
struct point origin,*pp;
main()
{
pp=&origin;
printf("origin is(%d%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d%d)\n",pp->x,pp->y);
}
A. origin is(0,0) origin is(0,1) B. origin is(1,1) origin is(0,0)
C. origin is(0,0) origin is(0,0) D. None of these

Answer and Explanation

Answer:origin is(0,0) origin is(0,0)

Explanation:
pp is a pointer to structure. we can access the elements of the structure either with arrow mark or with indirection operator.
Note:
Since structure pointer is globally declared x & y are initialized as zeroes

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.