I have two structs as follow :
what I am trying to do is to use scanf to read *(page_start).name from user which it length is max 9 character :Code:struct page { //the name of the page can not be more than 9 char name[10]; }; struct edge { struct page *page_start ; struct page *page_end ; };
It seems scanf is not reading user input , can somebody please help ?Code:int main(void) { scanf ("%d",&edges_num); edges = (struct edge *) malloc (sizeof(struct edge)*edges_num); int i = 0 ; for (i = 0 ; i < edges_num ; i ++) { scanf("%9s",edges[i].page_start->name); } return 0 ; }