Trivial C question: iterating through chars
Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.
Per Jessen per at computer.orgFri Apr 20 14:50:25 PDT 2001
- Previous message: Finding the largest double/float (non-"infinite") number...
- Next message: Beowulf vs Dual
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 20 Apr 2001 12:29:00 -0300, Chris Richard Adams wrote:
>I'd like to view all the ASCII chars on my system. I tried:
>
>char ch = 'NUL';
char ch = 0;
>int i;
>for ( i = 0; i < 500; i++)
> printf("Char: %c/n", ch + i");
One double-quote too many. Last one. And the /n should
be a \n instead.
>
>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++)
Yeah.
for ( ch = 0: ch < 256; ch++, printf("Char: %d = %c\n", ch, ch));
/Per, London
regards,
Per Jessen
- Previous message: Finding the largest double/float (non-"infinite") number...
- Next message: Beowulf vs Dual
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Beowulf mailing list
