Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Representation of integer constants on 16-bit machine

Posted By: Zoe Hughes     Category: C Programming     Views: 3582

Program that illustrates the use of integer constants on a 16-bit machine. The output in figure 2.3 shows that the integer values larger than 32767 are not properly stored on a 16-bit machine. However, when they are qualified as long integer (by appending L), the values are correctly stored.

Code for Representation of integer constants on 16-bit machine in C Programming

main()                                                     
{                                                          
    printf("Integer values\n\n");                          
    printf("%d %d %d\n", 32767,32767+1,32767+10);          
    printf("\n");                                          
    printf("Long integer values\n\n");                     
    printf("%ld %ld %ld\n", 32767L,32767L+1L,32767L+10L);  
 } 
                                                         

Output                                                     

    Integer values                                             
                                                               
    32767 -32768 -32759                                        
                                                               
    Long integer values                                        
                                                               
    32767 32768 32777                                          
  
Share: 


Didn't find what you were looking for? Find more on Representation of integer constants on 16-bit machine Or get search suggestion and latest updates.

Zoe Hughes
Zoe Hughes author of Representation of integer constants on 16-bit machine is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!