Trivial C question: iterating through chars

Chris Richard Adams chrisa at ASPATECH.COM.BR
Fri Apr 20 11:29:00 EDT 2001

I'd like to view all the ASCII chars on my system.  I tried:

char ch = 'NUL';
int i;

for ( i = 0; i < 500; i++)
	printf("Char: %c/n", ch + i");

This fails.

1.) What is illegal here?

2.) Can I use chars in my for look also...something like:

for ( ch = 'NUL; i < 500; ch++, i++)


Beowulf mailing list, Beowulf at
To change your subscription (digest mode or unsubscribe) visit

More information about the Beowulf mailing list