You are required to create an array of struct type students. In which you are required to store the
gender of the student using the ENUM. Also, you need to use pointers to store student
information in the heap. Student should have following information
First Name
Last Name
Roll No
Gender
I am not getting how to use enum in this.
What specifically is the part you don't understand?
Lines 43 and 47?
At its core, an enum is just a nicer way to name integers.
When you declare enum Gender { male, female }, male will have the value 0, and female will have the value 1.
So when you print ptr[i].gender, it will either print a 0 or a 1, which probably isn't what you want.
If you want it to print a string, you have to do the conversion yourself.
e.g.