English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#include
struct account
{
int accno;
char acctype;
char name_accholder[10];
float balance;
}s1,*pt;

main()
{
pt=&s1;

puts("enter accno type name of acc_holder balance");
scanf("%d%c%s%f",&pt->accno,&pt->acctype,
&pt->name_accholder,&pt->balance);

printf(" accno %d acctype %c name %s balance %f", pt->accno,pt->acctype,pt->name_accholder,pt->balance);
}

2007-02-21 22:02:53 · 3 answers · asked by saritha v 1 in Computers & Internet Programming & Design

3 answers

Do one thing try removing the "&" symbol from the scanf statement. Check if that is making any difference. I am doubting on that only.

2007-02-21 22:13:03 · answer #1 · answered by Santosh 2 · 0 0

scanf("%d %c %s %f" ,&pt->accno,&p...


this will solve your problem the spaces between the formatters will help scanf to recognise the input correctly else it takes the last key stroke(enter key) as an input for %c and crashes.

2007-02-22 02:39:31 · answer #2 · answered by Premith 2 · 0 0

Be clear in ur ques. Is the char acctype is not printed properly or the name_accholder array?

Let me know the output which you got...

2007-02-21 22:08:38 · answer #3 · answered by Rocks 2 · 0 0

fedest.com, questions and answers