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

Sir... please give some important coding questions asked by product companies..

0 Answers  


prog. to produce 1 2 3 4 5 6 7 8 9 10

4 Answers   TCS,


main() { int i=5; printf("%d",++i++); }

1 Answers  


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,






write a program to Insert in a sorted list

4 Answers   Microsoft,


void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }

1 Answers  


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


void ( * abc( int, void ( *def) () ) ) ();

1 Answers  


void main() { int i=5; printf("%d",i+++++i); }

3 Answers  


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


Categories