How do I make a integer into a ascii character?

This is a discussion on How do I make a integer into a ascii character? within the C Programming forums, part of the General Programming Boards category; For example. If I had an int of 65, how do I change it so that it turns into a ...

  1. #1
    Registered User AsleeKaizoku's Avatar
    Join Date
    Jan 2008
    Posts
    17

    How do I make a integer into a ascii character?

    For example.

    If I had an int of 65, how do I change it so that it turns into a A.
    Or an int of 118 to v?

    Anyone knows how to do this?

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    18
    Actually it's the same value in C.
    Let try: printf("%c",65);
    And printf("%d", 'A');

  3. #3
    Registered User AsleeKaizoku's Avatar
    Join Date
    Jan 2008
    Posts
    17
    How can i put a INT value to a character array?
    So what I want is:
    char ASCII_CODE[] <--- 65

  4. #4
    Registered User AsleeKaizoku's Avatar
    Join Date
    Jan 2008
    Posts
    17
    So for example:

    int hello1 = 0;
    char hello2[5];

    hello2 = hello1;

    will this work?

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    18
    You can put ASCII_CODE[i]=65;

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Ensure it's within the bounds of the ascii table, and ta-da! You've done it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2009, 03:12 PM
  2. memory issue
    By t014y in forum C Programming
    Replies: 2
    Last Post: 02-21-2009, 12:37 AM
  3. Converting ascii to integer without using atoi
    By sansuki in forum C++ Programming
    Replies: 9
    Last Post: 03-30-2005, 07:38 AM
  4. Convert a character to integer (ex '1' to 1)
    By VanJay011379 in forum C++ Programming
    Replies: 11
    Last Post: 03-18-2003, 01:14 AM
  5. Replies: 1
    Last Post: 07-31-2002, 11:49 AM

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