Thread: same error repeat

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    6

    Unhappy array and recusion error..try solve

    i really dunno what problem with this program
    i use cygwin compiler ... got lots error. but when i use microsoft visual c++ 5.0 no problem..
    can run,...
    plz help with me.. and save file with .c not in .cpp
    coz my compiler cannot run it...
    i use recusion and array for 10 employee..
    with add,adit view and delete main function
    Last edited by razoblade; 11-16-2001 at 06:53 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    First of all, you need to be clear as to whether this is C or C++, because it looks like C, with a couple of C++ features thrown in for good measure, like

    for(int i=0;i<10;++i)
    You can only declare the variable like this in C++. In C, do this
    int i;
    for(i=0;i<10;++i)

    Some of your loops overstep the array
    for (a=0; a<=10; a++)

    > int add_record(void);
    This prototype does not match the declaration of the function.

    > case '1':add_record(); break;
    And you ignore the return result. If you have no result, then make it a void function.

    > i use recusion
    There is no recursion in this code....
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed