F
Frederick Ding
Hi, guys!
I have two questions of some kind of style problem:
1. Is there a better one that can substitute this:
while (1) {
for (i = 0; i < 6; i++) {
scanf("%d", &a);
}
if ((a[0] == 0) && (a[1] == 0) && (a[2] == 0) && (a[3] == 0) &&
(a[4] == 0) && (a[5] == 0))
break;
else {
/* do other things */
}
}
I doubt that the while(1) is decent or not?
Can I find a better one than the "forever" loop?
2. still in the code above:
if (i == 0) break;
else {
}
or
if (i == 0) break;
...... /* do other things without else */
which one is better?
Thanks!
I have two questions of some kind of style problem:
1. Is there a better one that can substitute this:
while (1) {
for (i = 0; i < 6; i++) {
scanf("%d", &a);
}
if ((a[0] == 0) && (a[1] == 0) && (a[2] == 0) && (a[3] == 0) &&
(a[4] == 0) && (a[5] == 0))
break;
else {
/* do other things */
}
}
I doubt that the while(1) is decent or not?
Can I find a better one than the "forever" loop?
2. still in the code above:
if (i == 0) break;
else {
}
or
if (i == 0) break;
...... /* do other things without else */
which one is better?
Thanks!