RE: [Dev-C++] another annoying question
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Nehal S. <ns...@ix...> - 2003-11-03 22:28:21
|
void readS(db1 *a)
{
printf("name:");
scanf("%s",a->name);
printf("age:");
scanf("%d",a->i);
printf("%d",a->i);//to check
}
While scanning the integer value you should do: scanf("%d",&(a->i)); this
should work.
-----Original Message-----
From: vasanthsena x [mailto:vas...@ya...]
Sent: Monday, November 03, 2003 1:46 PM
To: Dev...@li...
Subject: [Dev-C++] another annoying question
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/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|