What is the reason for error while returning a structure in this C program?

前端 未结 5 1500
粉色の甜心
粉色の甜心 2020-12-21 14:54

My program intends to achieve this

(A) Write a C function named larger() that returns the later date of any two dates passed to it. For

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 15:31

    There are several little corrections needed in this program but your main problem is the difference between while and do while loops.

    while()
    {
      //Something
    }
    

    and

    do
    {
      //Something
    }
    while()
    

    differ in the fact that do while enters the loop atleast once and then checks for the condition to be satisfied. But while on the other hand never enters the loop if the condition is not satisfied. So in a nutshell you aren't entering the while loop and hence aren't reading anything from the user.

提交回复
热议问题