Data Types in C and C ++

Source: Internet
Author: User

Data Types in C and C ++

The C language adds the long type to the C99 standard.

# Include
 
  
# Include
  
   
// Compilation command: gcc-std = c99-pedantic int main (void) {char c_min = SCHAR_MIN; char c_max = SCHAR_MAX; unsigned char uc_max = UCHAR_MAX; long l_min = LONG_MIN; short s_min = SHRT_MIN; long ll_min = LLONG_MIN; // added the long type long ll_max = LLONG_MAX; unsigned long ull_max = ULLONG_MAX; printf ("max of unsigned char: % d \ n ", uc_max); printf (" min of char: % d \ n ", c_min); printf (" max of char: % d \ n ", c_max); printf ("min of short: % d \ n", s_min); printf ("min of long: % ld \ n", l_min ); printf ("min of long: % lld \ n", ll_min); printf ("max of long: % lld \ n", ll_max ); printf ("max of unsigned long: % llu \ n", ull_max); return 0 ;}
  
 

The C ++ language adds the long type to the C ++ 11 standard.

# Include
 
  
# Include
  
   
// G ++-std = c ++ 03-pedantic lim. cpp cannot be compiled. c ++ 1998 does not support the long-type using namespace std; int main () {// singed identifier generally omitting char c_min = SCHAR_MIN; char c_max = SCHAR_MAX; unsigned char uc_max = UCHAR_MAX; long l_min = LONG_MIN; // short for long short s_min = SHRT_MIN; // short int is short for short long ll_min = LLONG_MIN; // long int is abbreviated as long ll_max = LLONG_MAX; unsigned long ull_max = ULLONG_MAX; printf ("max of unsigned char: % d \ n", uc_max ); printf ("min of char: % d \ n", c_min); printf ("max of char: % d \ n", c_max); printf ("min of short: % d \ n ", s_min); printf (" min of long: % ld \ n ", l_min); printf (" min of long: % lld \ n ", ll_min); printf ("max of long: % lld \ n", ll_max); printf ("max of unsigned long: % llu \ n", ull_max ); return 0 ;}
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.