#include <stdio.h>
#include <string.h>
struct acho {
char ahn[50], add[200];
long int a, bal;
};
int main() {
struct acho s;
printf("enter name: \n");
gets(s.ahn);
printf("enter number: \n");
scanf("%ld", &s.a);
printf("enter address: \n");
gets(s.add);
printf("enter balance: \n");
scanf("%ld", &s.bal);
printf("Name: %s \n", s.ahn);
printf("Account number: %ld \n", s.a);
printf("Address: %s \n", s.add);
printf("Balance: %ld \n", s.bal);
return 0;
}
Why isn't this code an taking input for address? Can anyone find the bug please?
I have tried both input methods like gets
and fgets
but it is not taking input for address in any case.