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

}



struct point { int x; int y; }; struct point origin..

Answer / susie

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

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Code Interview Questions

Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  


main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }

1 Answers  


How can you relate the function with the structure? Explain with an appropriate example.

0 Answers  


how to delete an element in an array

2 Answers   IBM,


Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  






#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }

1 Answers  


main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }

2 Answers   Persistent,


Write a single line c expression to delete a,b,c from aabbcc

2 Answers   Microsoft,


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


how can i cast a char type array to an int type array

2 Answers  


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


Categories