Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Anything that appears after a piece of code in the main function disappears... what did I do wrong?

+2 votes
asked Oct 15, 2020 by Julia Dobbs (140 points)
Here's the code I wrote. Anything I put after this code in the main function just gets skipped over, including printf statements, if else, anything! I don't know what I've done wrong but I am almost positive the issue is somewhere in here:

int leapYr;   
    if (checkLeap(year) == 1)
        leapYr = 1;
        printf("\nThe given date was in a leap year.\n");
        return leapYr;
        leapYr= 0;
        printf("\nThe given date was not in a leap year.\n");
        return leapYr;

4 Answers

0 votes
answered Oct 18, 2020 by sahiram (140 points)




int i,year;

printf("dear user enter the year");



printf("given year is leaf year");


printf("no tleaf year");}
+1 vote
answered Oct 18, 2020 by Shivam Raina (200 points)
I think you should post your whole program, not just a part of it,
+1 vote
answered Oct 19, 2020 by Peter Minarik (89,040 points)

Please, share the entire code, not just a segment.

The problem is probably within the checkLeap function.

Also, if there is any error message, please share that as well.

One more note: why do you set leayYr to 1 or 0. Doesn't it hold the actual year (e.g. 2020)?

0 votes
answered Oct 21, 2020 by Najam-Blr (140 points)
You have a return statement in both if and else condition. A return statement ends the execution of function main().
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.