title: Structure to functions with pointers
body: <p>so I'm starting off with c and c++ and I am at structures, I've made a strcture for employees, defined the number of employees and made 2 functions: 1 to fill employees info and 1 to print them:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdio&gt;
  #include &lt;stddef.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #define NO 3
  using namespace std;
    struct employee {
      char fName[15];
      char lName[15];
      unsigned int age;
      char gender;
      bool married;
      char Pp[5];
    };
  
      typedef struct employee Employee;
      void fillEmployeeDetails(Employee * const employeePtr);
      void printEmployeeDetails(const Employee * const employeePtr);
  
    int main(){
      Employee Employees[NO];
      fillEmployeeDetails(Employees);
      printEmployeeDetails(Employees);
      //printf("%s",&amp;(Employees[0].Pp));
      return 0;
    }
  
      void fillEmployeeDetails(Employee * const employeePtr){
          char marriageStatus;
          int i;
        for(i = 0; i &lt; NO + 1; ++i){
              marriageStatus = '\0';
          system("CLS");
          printf("No. of employees: %d\n\n", NO);
          printf("Employee No. %d:\n\n", i+1);
          printf("First name: ");
          scanf("%14s", employeePtr[i].fName);
          printf("Last name: ");
          scanf("%14s", employeePtr[i].lName);
          printf("Age: ");
          scanf("%u", &amp;(employeePtr[i].age));
          while(employeePtr[i].age &gt; 150 || employeePtr[i].age &lt; 0){
              printf("Age: ");
              scanf("%u", &amp;(employeePtr[i].age));
          }
          while(employeePtr[i].gender != 'M' &amp;&amp; employeePtr[i].gender != 'F' ){
              printf("Gender: ");
              scanf("%s", &amp;(employeePtr[i].gender));
              employeePtr[i].gender = toupper(employeePtr[i].gender);
          }
          while(marriageStatus != 'Y' &amp;&amp; marriageStatus != 'N'){
              printf("Married?(Y/N): ");
              scanf("%s", &amp;marriageStatus);
              marriageStatus = toupper(marriageStatus);
              if(marriageStatus == 'Y' &amp;&amp; employeePtr[i].gender == 'F'){
                  employeePtr[i].married = true;
                  strcpy(employeePtr[i].Pp, "Mrs.");
                  }
              else{
                  if(marriageStatus != 'Y' &amp;&amp; employeePtr[i].gender == 'F'){
                   strcpy(employeePtr[i].Pp, "Miss");
                      }
                  else{
                    strcpy(employeePtr[i].Pp, "Mr.");
                      }
                  }
  
              }
        }
      }
      void printEmployeeDetails(const Employee * const employeePtr){
          system("CLS");
          for(int i = 0; i &lt; NO; ++i){
            printf("Employee No.: %d\n\nName: %s %s %s\nAge: %u\nGender: %c\n\n\n",i,employeePtr[i].Pp,employeePtr[i].fName,employeePtr[i].lName,employeePtr[i].age,employeePtr[i].gender);
          }
      }
  </code></pre>
  
  <p>I have a problem in function fillEmployeeDetails at </p>
  
  <pre><code>scanf("%s", &amp;marriageStatus); 
  </code></pre>
  
  <p>in which this line is changing my i(if i =>1) to 0, any help would be appreciated.</p>