Page 133 - C-Language
P. 133

Macro        Type                      Value

                                                                               63
          LLONG_MAX    long long int             +9223372036854775807 / 2  - 1

                                                                               64
          ULLONG_MAX   unsigned long long int    18446744073709551615 / 2  - 1

        If the value of an object of type char sign-extends when used in an expression, the value of
        CHAR_MIN shall be the same as that of SCHAR_MIN and the value of CHAR_MAX shall be the same as that
        of SCHAR_MAX . If the value of an object of type char does not sign-extend when used in an
        expression, the value of CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
        UCHAR_MAX.


        C99

        The C99 standard added a new header, <stdint.h>, which contains definitions for fixed width
        integers. See the fixed width integer example for a more in-depth explanation.


        String Literals


        A string literal in C is a sequence of chars, terminated by a literal zero.


         char* str = "hello, world"; /* string literal */

         /* string literals can be used to initialize arrays */
         char a1[] = "abc"; /* a1 is char[4] holding {'a','b','c','\0'} */
         char a2[4] = "abc"; /* same as a1 */
         char a3[3] = "abc"; /* a1 is char[3] holding {'a','b','c'}, missing the '\0' */


        String literals are not modifiable (and in fact may be placed in read-only memory such as
        .rodata). Attempting to alter their values results in undefined behaviour.


         char* s = "foobar";
         s[0] = 'F'; /* undefined behaviour */

         /* it's good practice to denote string literals as such, by using `const` */
         char const* s1 = "foobar";
         s1[0] = 'F'; /* compiler error! */


        Multiple string literals are concatenated at compile time, which means you can write construct like
        these.


        C99

         /* only two narrow or two wide string literals may be concatenated */
         char* s = "Hello, " "World";

        C99


         /* since C99, more than two can be concatenated */
         /* concatenation is implementation defined */
         char* s1 = "Hello" ", " "World";



        https://riptutorial.com/                                                                             109
   128   129   130   131   132   133   134   135   136   137   138