Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

while condition in do while loop

Status
Not open for further replies.

furqankaimkhani

Member level 4
Member level 4
Joined
Sep 10, 2010
Messages
79
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
1,946
Can someone pls make me understand this:

Code:
do{
        printf("enter temperature for day %d: ",day);
        scanf("%f",&temper[day]);
        }
        while(temper[day++]>0);

What i need to understand is the sequence in which this while condition will work here.
When will the post increment ++ be executed?

Correct me if i am wrong in it: First, the body of the loop is run once, and then the value (that element in temper array, whose subscript is day), is checked. If that element is greater than 0, then the value of day is incremented and then the body of the loop is again run. And so on...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top