Guys Guys Guys
I can't understand what's going on in your conversation ? The original poster of the code asked how to access the variables of an array but you guys are discussing something else.
For the sake of the original poster i just wanna say that to access the variables of structure use "." operator try the following code:
Code:
#include<stdio.h>
#include<conio.h>
typedef struct item
{
int a;
float b;
}ITEM;
ITEM var;
int main()
{
clrscr();
printf("\n Enter first variable\t");
scanf("%d",&var.a);
printf("\n Enter second variable\t");
scanf("%f",&var.b);
printf("\n first value is %d",var.a);
printf("\n second value is %f",var.b);
getch();
return 0;
}
OUTPUT:
Enter first variable 25
Enter second variable 62.5
first value is 25
second value is 62.500000
I hope you got it. IF you wanna access variables by using pointers then use "->" operator.
REALNAPSTER