title: Payslip generation program in c
body: <p>this is the question:</p>
  
  <blockquote>
    <p>Write an interactive program to generate pay slips for the staff of size 12 employees (2 members are clerks, one computer operator, 6 salesmen, 3 helpers) , working in a small chemist retail shop.  Assumptions can be made wherever necessary. The payslip should display the employee no., employee name, no. of days worked during the month,  date of generation of the payslip, month for which the salary is being paid, all the details of the payment, deductions, gross-pay and net-pay.</p>
  </blockquote>
  
  <p>when i run the program, it says invalid pointer, even though i havent used a pointer
  i am can anyone let me know what mistake(s) are there in this program?</p>
  
  <pre><code> #include &lt;time.h&gt;
      #include &lt;stdlib.h&gt;
      #include &lt;stdio.h&gt;
      #include &lt;conio.h&gt;
  
      char name[30][30], designation[20[20], empid[12][12];
      int i;
      int n = 12;
      int working_days = 27;
      float basic[12], days_absent[12], days_present[12], gross_salary[20], pf[12], allowance[12], net[12];
  
      void enter_details_of_employee();
      void display();
      void get_time();
  
      void main()
      {
      int k;
      printf("Enter 1 to enter employee details and 2 to display salary\n");
      scanf("%d", &amp;k);
  
      if(k == 1)
      {
      enter_details_of_employee();
      }
      else if(k == 2)
      {
      display();
      get_time();
      }
      else
      {
      printf("invalid choice");
      }
      }
  
  
      void enter_details_of_employee ()
      {
      int choice;
      int clerk_counter = 0, operator_counter = 0, salesman_counter = 0, helper_counter = 0, max = 0;
  
      do {
  
      printf("\n enter details of employees\n");
  
      printf("enter employee name\n");
      scanf("%c", &amp;name);
  
      printf("enter employee id\n");
      scanf("%c", &amp;empid);
  
      printf("enter your choice for employee designation\n 1.clerk \n 2.computer operator\n 3. salesman\n 4.helper\n");
      scanf("%d", &amp;choice);
  
      if (choice == 1)
      {
      if(clerk_counter == 2)
              {
                  printf("sorry, you have already entered the details of all clerks\n");
              }
  
                  else
  
              {
                  designation = "clerk";
                  basic = 8000.00;
                  printf("enter no of days absent\n");
                  scanf("%d", &amp;days_absent);
                  days_present = working_days - days_absent;
                  gross_salary = basic - ((days_absent / working_days) * basic);
                  pf = gross_salary*0.1;
                  allowance = gross_salary*0.55;
                  net = (gross - pf) + allowance;
                  clerk_counter++;
  
              }
  
  
  
          }
          else if (choice == 2)
          {
                  if(operator_counter == 1)
              {
                  printf("sorry, you have already entered the details of all computer operators\n");
              }
  
                  else
  
              {
                  designation = "computer operator";
                  basic = 9000;
                  printf("enter no of days absent\n);
                  scanf("%d", &amp;days_absent);
                  days_present = working_days - days_absent;
                  gross_salary = basic - ((days_absent / working_days) * basic);
                  pf = gross_salary*0.12;
                  allowance = gross_salary*0.75;
                  net = (gross - pf) + allowance;
                  operator_counter++;
  
              }
  
  
          }
  
          else if (choice == 3)
          {
                  if(salesman_counter == 6)
              {
                  printf("sorry, you have already entered the details of all salesman\n");
              }
  
                  else
  
              {
                  designation = "salesman";
                  basic = 10000;
                  printf("enter no of days absent\n);
                  scanf("%d", &amp;days_absent);
                  days_present = working_days - days_absent;
                  gross_salary = basic - ((days_absent / working_days) * basic);
                  pf = gross_salary*0.15;
                  allowance = gross_salary*0.95;
                  net = (gross - pf) + allowance;
                  salesman_counter++;
  
              }
  
  
          }
  
      else if (choice == 4)
          {
                  if(salesman_counter == 3)
              {
                  printf("sorry, you have already entered the details of all helpers\n");
              }
  
                  else
  
              {
                  designation = "helper";
                  basic = 6500;
                  printf("enter no of days absent\n);
                  scanf("%d", &amp;days_absent);
                  days_present = working_days - days_absent;
                  gross_salary = basic - ((days_absent / working_days) * basic);
                  pf = gross_salary*0.08;
                  allowance = gross_salary*0.45;
                  net = (gross - pf) + allowance;
                  helper_counter++;
  
              }
  
  
      }
  
      else
          {
      printf("invalid choice");
          }
  
          }
          while (max!=12);
          }
  
      void get_time()
      {
      time_t t = time(NULL);
      struct tm tm = *localtime(&amp;t);
  
      printf("now: %d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
      }
  
      void display()
      {
      printf("SALARY SLIP OF EMPLOYEES ";
      printf("---------------------------------------------------------------------------------------------------");
      printf("empid\t name\t days_absent\t days_present\t gross_salary\t   PF\t allowance\t net");
      printf("---------------------------------------------------------------------------------------------------");
  
      for(i=0;i&lt;n;i++)
      {
          printf(empid[i][i] name[i][i] basic[i] days_absent[i] days_present[i] gross_salary[i] pf[i] allowance[i] net);
      }
  
      }
  </code></pre>