Thread: sign, size, data type

  1. #1
    Registered User
    Join Date
    Jul 2018

    sign, size, data type


    if the register is 16 bit wide

    sign, size, data type

    #include <stdio.h>
    int main()
        sign short int X = 20;
        sign short char Y = 'A';
        return 0;
    What's meaning of following statement ?
    sign short int X = 20; sign short char Y = 'A';

    will size of register 8 bit because of short keyword ?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    In standard C, there is no such thing as a short char, and there is no sign keyword (but perhaped you had signed in mind). A short int has a minimum range that mathematically requires at least 16 bits to represent it. There is no concept of register that is defined in C, at most the standard makes reference to registers with the reader expected to understand the concept from beyond C, and where it does define the semantics of the register keyword, no mention is made of registers themselves:
    Quote Originally Posted by C17 Clause 6.7.1 Paragraph 6
    A declaration of an identifier for an object with storage-class specifier register suggests that access to the object be as fast as possible. The extent to which such suggestions are effective is implementation-defined.
    So, reasonable answers to your question range from "your question does not make sense" to "no" to "it depends on the implementation".
    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. Replies: 11
    Last Post: 04-23-2019, 09:05 AM
  2. Size of the data type
    By kannanm in forum C Programming
    Replies: 9
    Last Post: 03-08-2014, 09:02 PM
  3. how to get Data Type Size Independet of System?
    By pablomallen in forum C Programming
    Replies: 10
    Last Post: 02-25-2008, 02:24 PM
  4. Read size of data array when reading .txt data
    By Taquito in forum C Programming
    Replies: 13
    Last Post: 04-29-2007, 01:52 AM
  5. Int data type size
    By ytrewq in forum C Programming
    Replies: 3
    Last Post: 02-28-2005, 03:53 PM

Tags for this Thread