
Originally Posted by
GReaper
I think Milo7 nailed it( ignoring their non-existent indentation ). The solution they implemented works just fine, although I would go for "count < 127" because official ascii values are from 0 to 128, not 256.
his code gets this:
Code:
userx@~/bin <> ./a.out
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4
5 6 7 8 9 : ; < = > ? @ A B C D E F G H
I J K L M N O P Q R S T U V W X Y Z [ \
] ^ _ ` a b c d e f g h i j k l m n o p
q r s t u v w x y z { | } ~ € ‚ ƒ „
… † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜
™ š › œ ž Ÿ
..
userx@~/bin <>
as I thought it was the other way around, using the alphabet to get the numeric values printed out not using he numeric values to get the chars printed out.
where this
Code:
int c = 0;
char ascc [6] = { 'a' , 'A', 'b', 'B', 'c', 'C'};
while ( c < 6)
{
printf("%d ", (int)ascc[c]);
c++;
}
prints this:
lower 'a' is 97
Cap 'A' is 65
table reference
Reference: Nonprintable and Printable ASCII Characters - Technical Documentation - Support - Juniper Networks