Well nothing seems obviously wrong with the struct.
How are you running the program - from within the IDE?
What about if you create a separate cmd console, then run the executable manually?
This initialises the struct to see if it changes
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
struct employee {
char name[30];
char address[100];
int age;
float salary;
} emp1 = {
"fred",
"flintstone",
42,
12345.6
};
if ( feof(stdin) ) {
printf("Not good - stdin at EOF already\n");
}
printf("Enter the name of the employee: ");
scanf("%s", emp1.name);
printf("Enter the address of the employee: ");
scanf("%s", emp1.address);
printf("Enter the age of the employee: ");
scanf("%d", &emp1.age);
printf("Enter the salary of the employee: ");
scanf("%f", &emp1.salary);
printf("the age of emp1 is: %s\n", emp1.name);
printf("the age of emp1 is: %s\n", emp1.address);
printf("the age of emp1 is: %d\n", emp1.age);
printf("the salary of emp1 is: %f\n", emp1.salary);
return 0;
}