Thread: Saving ASCII code

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    23

    Saving ASCII code

    How do i save the ASCII value? I'm trying to add the ASCII value for each character in a string.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    5
    Conversions from a char to an int type are already built into C. For example:
    Code:
    int number;
    char letter = 'm';
    
    number = 'm';       /* number now holds the ascii value for m */
    Ascii values of a string would probably require a loop to find the sum of the ascii values of each character within the character array.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ASCII code goes into minus
    By Degenko in forum C Programming
    Replies: 4
    Last Post: 05-26-2007, 12:35 PM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Office access in C/C++ NOT VC++!! :)
    By skawky in forum C++ Programming
    Replies: 1
    Last Post: 05-26-2005, 01:43 PM
  4. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  5. covert ascii code to character
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 04-25-2002, 09:53 PM