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

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

0 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   TCS,


main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }

29 Answers   IBM, TCS, UGC NET, Wipro,


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,






Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

3 Answers   Hexaware,


Write a routine to implement the polymarker function

0 Answers   TCS,


void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }

3 Answers   Accenture,


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


main() { extern out; printf("%d", out); } int out=100;

1 Answers  


print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!

35 Answers   Tata Elxsi, TCS, VI eTrans,


Categories