title: trying to scanf value in a function to a struct inside a struct with a pointer
body: <p>just look at the code please , says it all </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  struct DOB
  {
  int y,m,d;
  }typedef DOB_t;
  
  struct Courses
  {
  char* NameofCourse;
  char* Lec;
  int CourseID;
  
  }typedef Course_t;
  
  struct Student
  {
  char Name[20];
  float Grade;
  DOB_t dob;
  Course_t Courses;
  
  }typedef Student_t;
  
  void addstudent(Student_t* s);
  void addDate(DOB_t* dob);
  void addCourse(Course_t* c);
  
  main()
  {
  int opt;
  Student_t s;
  printf("Please choose one of the options:\n");
  printf("&lt;&lt;&lt;&lt;&lt;1.add student&gt;&gt;&gt;&gt;&gt;\n&lt;&lt;&lt;&lt;&lt;2.print student&gt;&gt;&gt;&gt;&gt;\n");
  scanf("%d",&amp;opt);
  switch(opt)
      case 1:
  {
      addstudent(&amp;s);
      break;
  }
  
  }
  
  void addstudent(Student_t* s)
  {
  printf("Enter student's name: ");
  scanf("%s",s-&gt;Name);
  printf("Enter Grade: ");
  scanf("%.2f",s-&gt;Grade);
  printf("Enter DateOfBirth: ");
  ***addDate(&amp;(s-&gt;dob));***
  addCourse(&amp;(s-&gt;Courses));
  }
  
  void addDate(DOB_t* dob)
  {
  ***scanf("%d %d %d", dob-&gt;d,dob-&gt;m,dob-&gt;y);***
  }
  
  void addCourse(Course_t* c)
  {
  printf("Enter Course Name And Lec Name: ");
  scanf("%s %s",c-&gt;NameofCourse,c-&gt;Lec);
  printf("Enter Course ID: ");
  scanf("%d",c-&gt;CourseID);
  }
  </code></pre>
  
  <p>it's not finished yet , but look at the highlighted row - i get an error when i'm triyng to scan values of DateofBirth using pointers into (s->DOB ) to keep the data in the value after function closes. 
  hope you understand my problem.</p>