#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
struct student
{
int roll;
char grade;
};
struct student s1,*p;
p=&s1;
printf("Enter the roll no.: ");
scanf("%d", &s1.roll);
printf("Enter the grade: ");
scanf("%c", &s1.grade);
printf("Roll no. %d\nGrade %c", (*p).roll,p->grade);
return 0;
}
I couldn't find the problem so I added in a bunch of header files just in case that was causing it. I have been getting similar problems in a lot of other codes that have something do with structs, strings, gets(), fgets().