I've gotten really confused about this... Below is a simple program I was messing with trying to fix my problem. ...Which I guess is in the if statements. The first "if" is fine...it prints out the first 10 numbers if the array. I want the second if to print out the second set of 10 numbers, but it prints out the first 20 instead...
The third is fine now, but at first I had
if(i<=20, i<30); which gave the same problem as with the second if - all 30 numbers were printed out instead of the third set of 10. Why is that different than
if(i<30, i>=20), which works?
Thanks.
Code:
#include <stdio.h>
main()
{
int i;
double array[30];
for(i=0; i<30; i++){
array[i]=i;
}
for (i=0; i<30; i++) {
if(i<10){
printf("111 %e\n", array[i]);
}
if(i>=10, i<20){
printf("222 %e\n", array[i]);
}
if(i<30, i>=20){
printf("333 %e\n", array[i]);
}
}
getchar();
}