Page 42
Write a loop equivalent to the for
loop above without using &&
or ||
#include <stdio.h>
#define MAX_LEN 1000
int main()
{
int c;
int i = 0;
char s[MAX_LEN];
while (i < (MAX_LEN - 1)) {
c = getchar();
if (c != '\n') {
if (c != EOF) {
s[i] = c;
}
}
i++;
}
}