Min Const Minimum Value Data Type Maximum Value #Bytes

Min Const Minimum Value Data Type Maximum Value #Bytes

<p> INTEGERS</p><p>Minimal ANSI Limits ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– min const minimum value data type maximum value #bytes ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– short int -128 <= short int <= +127 1 int -32,768 <= int <= +32,767 2 long int -2,147,483,648 <= long int <= +2,147,483,647 4 –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––</p><p> min const minimum value data type maximum value #bytes ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– unsigned short int 0 <= unsigned short int <= +255 1 unsigned int 0 <= unsigned int <= +65,535 2 unsigned long int 0 <= unsigned long int <= +4,294,967,295 4 –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––</p><p>Integer Format Specifiers –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– Data Type Format Specifier Right Justify 8 Characters Left Justify 8 Characters –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– short int %h or %hi %8h or %8hi %–8h or %–8hi int %d or %i %8d or %8i %–8d or %–8i long int %ld or %li %8ld or %8li %–8ld or %–8li</p><p> unsigned short int%hu %8hu %–8hu unsigned int %u %8u %–8u unsigned long int %lu %8lu %–8lu ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––</p><p>%5d or %5i used to right justify (5 character) int %7ld or %7li used to right justify (7 character) long int %3h or %3hi used to right justify (3 character) short int %12u used to right justify (12 character) unsigned int %8lu used to right justify (8 character) long unsigned int %4hu used to right justify (4 character) short unsigned int %-5d or %-5i used to left justify (5 character) int %-7ld or %-7li used to left justify (7 character) long int %-3h or %-3hi used to left justify (3 character) short int</p><p>%o or %O used for Octal Notation %x or %X used for Hexadecimal Notation</p><p>The format control string may also include any of the following escape sequences: (note that the escape sequences begin with the \ and alter the flow of printing for special events)</p><p>\n (newline) to move the cursor to the first position of the next line \r (return) to move the cursor to the first position of the line \f (formfeed) to move the cursor to the first position of the first line [2]</p><p> of the next page (often clears console screen) \t (horiz tab) to move the cursor to the next horizontal tab position of the current line \b (backspace) to move the cursor one position to the left \a (alert) to produce a visible or audible alert </p><p>\\ to print the backslash \" to print the double quote \' to print the single quote \? to print the question mark \07 to ring the bell</p><p>PROGRAM IntOut.c</p><p># include <stdio.h> # define MAX 3333 # define MAX 3</p><p> main() { int No;</p><p>No = 2371; printf ("Example 1 : *%d*\n",2371); printf ("Example 2 : *%2d*\n",MAX); printf ("Example 3 : *%4d*\n",2371); printf ("Example 4 : *%7d*\n",2371); printf ("Example 5 : *%-7d*\n",No); printf ("Example 6 : *%-2d*\n",2371); printf ("Example 7 : *%d%d%d*\n",1,2,3); printf ("Example 8 : *%d%d%d*\n",1,-2,3); printf ("Example 9 : *%d %d %d*\n",1,2,3); printf ("Example 10: *%2d %2d*\n",123,2371); printf ("Each int declared allocates %lu bytes\n",sizeof (int)); printf ("The amount of space allocated for variable No is %lu bytes\n", sizeof (No)); printf ("The amount of space allocated constant MAX is %lu bytes\n",sizeof (MAX)); printf ("The amount of space allocated constant MIN is %lu bytes\n",sizeof (MIN)); return (0); }</p><p>Output from program IntOut.c is as follows:</p><p>Example 1 : *2371* Example 2 : *3333* Example 3 : *2371* Example 4 : * 2371* Example 5 : *2371 * Example 6 : *2371* Example 7 : *123* Example 8 : *1-23* Example 9 : *1 2 3* Example 10: *123 2371* [3]</p><p>Each int declared allocates 2 bytes The amount of space allocated for variable No is 2 bytes The amount of space allocated constant MAX is 2 bytes The amount of space allocated constant MIN is 2 bytes</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us