[SOLVED] Function not giving normal output

Issue

I am trying to compile my practice on functions. I tried many times to compile this and I bumped into this issue.

Here below is my code:

#include <stdio.h>
int displayFlow();
int main(){
    int displayFlow();
   
}
int displayFlow(){

int try1,try2,try3;
printf("enter any given number...\n");
scanf("%d", &try1);
printf("if u entered above 10, ur out\n...please enter another guess...\n");
scanf("%d", &try2);
printf("if u entered below 5 then u won! !");


}

and this is the output I got:

function.c:22:5: note: declared here
 int test(){

Solution

You declared your function again inside main. Remove int from infront of displayFlow.

#include <stdio.h>
int displayFlow();
int main(){
    displayFlow();

}
int displayFlow(){

int try1,try2,try3;
printf("enter any given number...\n");
scanf("%d", &try1);
printf("if u entered above 10, ur out\n...please enter another guess...\n");
scanf("%d", &try2);
printf("if u entered below 5 then u won! !");


}

Answered By – AaronSinn

Answer Checked By – Senaida (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *