`long` — C++ Keyword
`long` — C++ Keyword
The long keyword in C++: a signed integer type at least 32 bits wide.
`long` — C++ Keyword
The long keyword in C++: a signed integer type at least 32 bits wide.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
longShorthand for long int. At least 32 bits on all platforms; 64 bits on Unix/Linux 64-bit systems but 32 bits on Windows 64-bit.
long n;
long int n;
long long n; // at least 64 bits (C++11 / C99)
unsigned long ul;
unsigned long long ull;
#include <print>
#include <climits>
int main() {
long a = 1'000'000L;
long long b = 9'000'000'000LL;
std::println("{}", a); // 1000000
std::println("{}", b); // 9000000000
std::println("long max: {}", LONG_MAX);
std::println("long long max: {}", LLONG_MAX);
}
long width is platform-dependent; use std::int32_t / std::int64_t for portability.L for long, LL for long long, UL / ULL for unsigned variants.longint main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}