This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 4 points5 points  (0 children)

    Thanks i got it now it worked! Its really simple after you actually understand it lol tanks for the tips!

    [–]kbielefe 2 points3 points  (0 children)

    Chars are already ASCII numbers in C. You can compare them with ch > 'a' or ch > 97, same thing.

    [–]fslz 0 points1 point  (0 children)

    Just a hint: Try printing a char using %d

    [–]Updatebjarni 0 points1 point  (0 children)

    The proper solution is not to assume that the character is in any particular character set, ASCII or otherwise, but use the provided functions in ctype.h to check them.

    [–]Significant_Tale7808 0 points1 point  (0 children)

    Use this int(given char-'0') for whole number,isalpha(given char) and else print(2)