Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 75

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 78

Answer:

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);
}


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 point is globally declared x & y are initialized as zeroes

Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 75 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: