Home >Backend Development >C#.Net Tutorial >What does lld mean in c language?
In C language, lld represents a 64-bit signed integer, that is, long long decimal. Specifically: the int type is a 32-bit integer, ranging from -2^31 to 2^31-1. The long long type is a 64-bit integer, ranging from -2^63 to 2^63-1. A long long type variable can be declared by adding the ll suffix after the variable name. Commonly used functions include: %lld: formatted input/output. atoi: Convert string to int, use atoll to convert to long long. When using the long long type, you need to pay attention to its 64-bit attributes and use the corresponding functions to handle it.
The meaning of lld in c language
In C language, lld
is# Abbreviation of ##long long decimal, used to represent a 64-bit signed integer.
Detailed explanation
In C language, the integer types areint (32 bits) and
long long (64 Bit). The
int type can represent integers in the range
-2^31 to
2^31-1, while the
long long type can represent the range It is an integer from
-2^63 to
2^63-1.
int, you can use the
long long type. When declaring a
long long variable, you need to add the
ll suffix after the variable name, for example:
<code class="c">long long my_number;</code>is using the
long long type When a variable is used, it can be used as an ordinary integer, but it should be noted that it is a 64-bit integer and needs to be processed using appropriate functions and macros.
long long type:
: used for
printfFormat input and output data of
long long type in # and
scanf.
: Convert a string to type
int. If you need to convert to
long long type, you need to use the
atoll(const char *str) function.
: Convert a string to
long long type.
Example
<code class="c">#include <stdio.h> int main() { long long my_number; printf("请输入一个数字:"); scanf("%lld", &my_number); printf("您输入的数字是:%lld\n", my_number); return 0; }</code>In this example, we declare a variable of type
long longmy_number
. We then use the
scanf function to get a number from the user input and store it in
my_number. Finally, we use the
printf function to output the value of
my_number.
The above is the detailed content of What does lld mean in c language?. For more information, please follow other related articles on the PHP Chinese website!