in using turbo c++ IDE i got this error in void main()

#include<conio.h>
    #include<stdio.h>
    #include<math.h>

     void main(){
        input_data1( );

    }int input_data1(void)
    {
        int input;
        printf("\n\n**************CPU Scheduling*************\n");
        printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First Serve\t|\n|\t3. Round Robin\t\t\t|\n|\t4. All CPU Scheduling.\t\t|\n*****************************************\n");
        scanf("%d",&input);
        return input;
    }
    void display()
    {
        input_data1();

    }

Edited 3 Years Ago by MrProgammer: rewrite

Everything must be declared before it's used. A function prototype is the function signature without a body and terminated by a semicolon:

#include<conio.h>
#include<stdio.h>
#include<math.h>

int input_data1(void);
void display(void);

void main(void)
{
    input_data1();
}

int input_data1(void)
{
    int input;
    printf("\n\n**************CPU Scheduling*************\n");
    printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First Serve\t|\n|\t3. Round Robin\t\t\t|\n|\t4. All CPU Scheduling.\t\t|\n*****************************************\n");
    scanf("%d",&input);
    return input;
}

void display(void)
{
    input_data1();
}

Alternatively, you could define your functions prior to their first use. A definition also constitutes a declaration:

#include<conio.h>
#include<stdio.h>
#include<math.h>

int input_data1(void)
{
    int input;
    printf("\n\n**************CPU Scheduling*************\n");
    printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First Serve\t|\n|\t3. Round Robin\t\t\t|\n|\t4. All CPU Scheduling.\t\t|\n*****************************************\n");
    scanf("%d",&input);
    return input;
}

void display(void)
{
    input_data1();
}

void main(void)
{
    input_data1();
}

Edited 3 Years Ago by deceptikon

This article has been dead for over six months. Start a new discussion instead.