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.

building for with while,........

Status
Not open for further replies.

aviv6371

Member level 2
Joined
Jul 7, 2006
Messages
45
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,574
hi,

how can i build for loop using only while using c language :
for (line=0,cl=0,temp=0;temp<=i,cl>15;cl++,++temp)

thanx ,
avi.
 

That loop isn't going to do much.

Separate the three parts of the 'for' statement:
Code:
line=0,cl=0,temp=0;
while (temp<=i,cl>15)
  cl++,++temp;
 

if i change the instruction little bit how would it change the order of the instructions ?? :
for (line=0,cl=0,temp=0;temp<=i,cl>15;cl++,++temp)
{
proc1();
proc2();
}

thanx for the fast reply,
avi.
 

To change that into a 'while' loop:
Code:
line=0,cl=0,temp=0;
while (temp<=i,cl>15)
{
  proc1();
  proc2();
  cl++,++temp;
}
Assuming all the variables are integers, the loop will never run because "cl>15" is false, and because "temp<=i" has no effect due to the comma operator.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top