How to return the ASCII code value of a character in C?

This is a discussion on How to return the ASCII code value of a character in C? within the C Programming forums, part of the General Programming Boards category; How to return the ASCII code value of a character in C? thx..!...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    101

    How to return the ASCII code value of a character in C?

    How to return the ASCII code value of a character in C?

    thx..!

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    char j = 'j';
    printf("%d",j);


    Like that?

  3. #3
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    The chars are stored as ASCII codes anyway, so just return it.
    MSVC++ 6.0

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    197
    Hi!
    The only difference between a char and an integer is that a char has in most cases a size of one byte and the integer two bytes.

    klausi
    When I close my eyes nobody can see me...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 09:55 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 04:42 PM
  3. need help program crashing
    By tunerfreak in forum C++ Programming
    Replies: 14
    Last Post: 05-22-2006, 12:29 PM
  4. Alegro closes out on me
    By campsoup1988 in forum C++ Programming
    Replies: 8
    Last Post: 04-03-2006, 11:40 AM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 05:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21