I have added few steps in code but my question is sameIt's not clear what you're asking? The pointer inside your struct will point to nothing until you assign it a value. It's just a variable like any other variable.
What does "strcut Student *NextStudent; /*Pointer of structure */" store in structure ?
C:
#include<stdio.h>
struct Student
{
int Name[];
int Marks;
strcut Student *NextStudent; /*Pointer of structure */
};
{
int main (void)
{
/*dynamic memory allocation for structure */
struct Student *NewStudent = (struct Student*) malloc(10 * sizeof(struct Student));
if ( NewStudent == NULL)
{
printf("Memory not Available \n");
exit(1);
}
NewStudent -> Marks = 95;
NewStudent -> NextStudent;
free(NewStudent);
return 0;
}
Last edited: