Thread: Storage of integer and character values in C

  1. #1
    Registered User
    Join Date
    Nov 2019

    Storage of integer and character values in C


    Can integer variable store char value?

    integer variable store integer value like 20 , -10

    my program shows int type variable can be store char value.

    void main ()
        int Code = 'A';
        printf("Code %d \n", Code);
        printf("Code %c \n", Code); 

    Code 65
    Code A

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    You might be surprised to learn that the type of 'A' is int.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to convert character into integer?
    By tmac619619 in forum C Programming
    Replies: 6
    Last Post: 11-01-2012, 03:47 PM
  2. Convert integer to character
    By Swoorup in forum C++ Programming
    Replies: 20
    Last Post: 11-28-2011, 04:53 AM
  3. Replies: 5
    Last Post: 06-12-2007, 02:18 PM
  4. integer to character
    By Gil22 in forum C++ Programming
    Replies: 2
    Last Post: 05-05-2005, 09:20 PM
  5. Placing an integer into a character
    By WebmasterMattD in forum C++ Programming
    Replies: 8
    Last Post: 09-05-2002, 07:49 AM

Tags for this Thread