Sorry guys its been a long day.In the following
program instead of giving me the value of i, it prints
the adress of i. any thoughts why :( ?
#include <stdio.h>
typedef struct db {
char name[10];
int i;
} db1;
void readS(db1 *a);
void writeS(db1 *a);
main()
{
db1 mydb[20];
db1 *p;
p = mydb;
printf("Enter Data\n");
readS(p);
writeS(p);
system("PAUSE");
return 0;
}
void readS(db1 *a)
{
printf("name:");
scanf("%s",a->name);
printf("age:");
scanf("%d",a->i);
printf("%d",a->i);//to check
}
void writeS(db1 *a)
{
printf("%s,%d\n",a->name,a->i);
}
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
|