Thread: C program crashed

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    21

    C program crashed

    this is my program.

    Code:
    #include<stdio.h>
    #include<conio.h>
    struct abc
    {
     char name[20];
     int day;
     char month[10];
     int year;
     float salary;
    };
    
     void main()
     {
     struct abc person[10];
     //float totalsalary=0;
     int n,i,t;
     char month[12];
     clrscr();
     printf("enter number of employees\n");
    
    
    
     scanf("%d",&n);
     printf("number of employee =%d\n",n);
    
     for(i=0;i<=n;i++)
     {
      printf("input values\n");
      scanf("%s %d %s %d %f",person[i].name,&person[i].day,person[i].month,&person[i].year,&person[i].salary);
    //  printf("%s %d %s %d %f\n",person[i].name,person[i].day,person[i].month,person[i].year,person[i].salary);
    
    
     }
     /*
     printf("enter the month for totalsalary");
     scanf("%s",month);
    
     for(i=0;i<=n;i++)
     {
      t=strcmp(person[i].month,month);
      if(t==0){
         totalsalary=totalsalary+person[i].salary;
      }
     }
    
    
    printf("the totalsalary for giving moth = %f",totalsalary);  */
    getch();
    }
    enter number of employees
    2

    number of employee =2

    input values
    Test 23 january 2012 6700 //Enter pressed

    Now It goes back to turbo c++ editor

    what I'm doing wrong ?
    Last edited by Stream; 04-15-2018 at 05:00 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program crashed
    By byebyebyezzz in forum C++ Programming
    Replies: 1
    Last Post: 12-06-2011, 04:42 PM
  2. Program crashed, no compilation errors
    By kaopei in forum C Programming
    Replies: 1
    Last Post: 11-20-2010, 06:44 AM
  3. using fprintf crashed my program
    By kiros88 in forum C Programming
    Replies: 4
    Last Post: 11-08-2010, 01:14 PM
  4. Auto shutdown of crashed program...
    By phil_drew in forum Windows Programming
    Replies: 1
    Last Post: 04-24-2004, 12:48 AM
  5. My Program Crashed help!!!
    By St0rmTroop3er in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2003, 04:25 PM

Tags for this Thread