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();

    }

Recommended Answers

All 3 Replies

HELP Please.... new C

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();
}

Thanks,,. your a life saving guy! T_T

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.