[MOVED] C programming for conditional statement with c6713 dsp processor

Status
Not open for further replies.

chinnydas

Junior Member level 1
Joined
Jun 4, 2012
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,394
hi everybody,
I am developing the code for C6713 dsk with some conditional statements.
In that, i want to run
Code:
for(i=0;i<=0;i++)
{
printf("%d",i);
}

continuously, i want to run the loop like infinite times. so, what changes should made in this loop to execute infinite times?
Suggest me some options please.
Thank-You

regards;
chinny
 
Last edited by a moderator:

Re: C programming for conditional statement with c6713 dsp processor

It Goes in infinite Loop and it will not show any result.
 
Re: C programming for conditional statement with c6713 dsp processor

It Goes in infinite Loop and it will not show any result.

hi,
check it clearly,
Code:
 for(i=0;i>0;i++)
{
printf("%d",i);

}


regards,
chinny
 
Last edited by a moderator:

Re: C programming for conditional statement with c6713 dsp processor

the for loop can be written in a number of other ways as well

like for (i=0;;i++)
 
Re: C programming for conditional statement with c6713 dsp processor

so you are concluding that this loop will run infinite times,
Code:
for(i=0;i>0;i++)
{
printf("%d",i);
}
if so, what will be the output?
what value it will produce?
 
Last edited by a moderator:

Re: C programming for conditional statement with c6713 dsp processor

its going to print i at each iteration so the output would be 0123... so on
 
Re: C programming for conditional statement with c6713 dsp processor

how it is possible, still i don't understand...
when i=0, then it checks for condition, i>0, how it is possible, there is nothing i=0,i>0 i<0, 0 is what 0 right, then the loop will not execute even once..... right?
 

Re: C programming for conditional statement with c6713 dsp processor

how it is possible, still i don't understand...
when i=0, then it checks for condition, i>0, how it is possible, there is nothing i=0,i>0 i<0, 0 is what 0 right, then the loop will not execute even once..... right?


your code was for(i=0;i<=0;i++) where the test expression is i<=0

- - - Updated - - -

and in for(i=0;;i++) the test field is set empty so its always true
 
Re: C programming for conditional statement with c6713 dsp processor

ok fine, in this case for(i=0;;i++) will always true.
what about in the case of, for(i=0;i>0;i++)?
 

Re: C programming for conditional statement with c6713 dsp processor

what about in the case of, for(i=0;i>0;i++)?
As you said, the loop will not execute even once.
And i keeps the value i=0.
Regards
Z
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…