My question (as the title suggests) is how to ignore the inputs in the console.
My program will take inputs representing first, middle and last name. For example, stud.name.mdlename should be empty if anyone does not have a middle name, it should be ignored so that it didn't take any input.
// write a program to read and display information of a
// student using a structure within a structure.
#include <stdio.h>
typedef struct studentName
{
char frstnme[10];
char mdlenme[10];
char lstnme[10];
}Name;
typedef struct studentdob
{
int dd;
int mm;
int yy;
}DOB;
typedef struct studentinfo
{
int r_no;
Name name;
char course[10];
DOB dob;
float fees;
};
int main()
{
struct studentinfo stud;
printf("\nEnter registration number : ");
scanf("%d",&stud.r_no);
printf("Enter First name :\n");
scanf("%s",stud.name.frstnme);
printf("Enter Middle name :\n");
scanf("%s",stud.name.mdlenme);
printf("Enter Last name :\n");
scanf("%s",stud.name.lstnme);
printf("\n");
printf("Enter DOB [dd.mm.yy]:");
scanf("%d %d %d",&stud.dob.dd,&stud.dob.mm,&stud.dob.yy);
printf("\nEnter the fees:");
scanf("%f",&stud.fees);
printf("\n ***Student's details***");
printf("\nRegistration number : %d",stud.r_no);
printf("\nName of student : %s %s %s",stud.name.frstnme,stud.name.mdlenme,stud.name.lstnme);
printf("\nD.O.B- %d.%d.%d",stud.dob.dd,stud.dob.mm,stud.dob.yy);
printf("\nTotal Fees :%f",stud.fees);
}