Try this code.
Code:
#include <stdio.h>
struct Stype
{
char regnum[4];
int cred;
char fname[20],sname[20];
float cost [75];
float fee [95];
};
int main()
{
struct Stype studdetails;
printf("Enter registration number ");
fgets(studdetails.regnum,4,stdin);
while(getchar() != '\n');
printf("Enter surname ");
fgets(studdetails.sname,20,stdin);
printf("Enter forename ");
fgets(studdetails.fname,20,stdin);
printf("Enter credits being undertaken ");
scanf("%d",&studdetails.cred);
while(getchar() != '\n');
printf("Your surname is: %s", studdetails.sname);
return 0;
}