64-bit integer in C

Source: Internet
Author: User

_ Int64 is a signed 64-bit integer data type, that is, long in C # And bigint in SQL Server. The value range is-2 ^ 63 (-9,223,372,036,854,775,808) to 2 ^ 63-1 (9,223,372,036,854,775,807), the storage space occupies 8 bytes. Used when the integer value may exceed the range supported by the int data type.
_ Int64 is created by Microsoft. If you want to use a 64-bit integer type, long is included in C, as follows:

# Include <stdlib. h> # include <stdio. h> # include <limits. h> int main (void) {long llnum = llong_max; unsigned long ullnum = ullong_max; printf ("% LLD \ n % LlU", llnum, ullnum ); return exit_success ;}

Reference: ANSI c99

Use _ int64 for VC, BCB, and mingw GCC in Microsoft Windows, as follows:

_ Int64 N; scanf ("% i64u", & N); printf ("% i64u \ n", N );

Mingw GCC also supports long declaration, but the input and output format strings still start with i64.
The _ int64 keyword and % i64 label are indeed proprietary to Microsoft. Standard C uses long and % LLD. Therefore, programming in UNIX, Linux, and cygwin should adopt standard usage.

Related Article

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.