I am not sure what this means and I get it all the time. Can someone help me fix this code?
[ char add_account(account_t a)
8 int i, N=1000000;
9 char ch;
10 char str1, str2;
11 int m=20;
17 printf("Enter first name\n");
18 fgets(str1, m, stdin);
19 strcpy(a.first, str1);
20 printf("Enter middle initial\n");
23 printf("Enter last name\n");
24 fgets(str2, m, stdin);
25 strcpy(a.last, str2);
26 printf("Enter new account number\n");
27 scanf("%d", &a.number);
28 printf("Enter opening balance\n");
29 scanf("%f", &a.balance);
31 else printf("No more new accounts accepted\n");
33 return a;
Jump to Post
I am not sure what this means and I get it all the time.
Really and what would that be?
Can someone help me fix this code?
What's wrong with it beside not having code tags?
Jump to Post
because your first arguments to fgets are all single characters.
the argument is supposed to be a STRING. not a single character. a single character is actually an 8-bit integer, so it thinks you are passing in an integer when it expects the starting position of a string (aka …
All 11 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.