Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of "1ULL"in c programming language [duplicate]

Tags:

c

for (x = 0; x < 1ULL<<(2*length); ++x){

this above line is a c program code which I downloaded. It has a part "1ULL". First I thought it was a mistake. but the code compiles and works well. can anyone please explain me what is that thing mean.

thank you....

like image 551
user2608075 Avatar asked Jul 22 '13 19:07

user2608075


People also ask

What is 1ull in C?

It means unsigned long long.

What does %2 mean in C language?

The % operator in C is the “modulo” operator, which has the same precedence as the * (multiply) and / (divide) operators. Its value is the remainder of the integer division of its two operands. For example, if x is 13, then the value of “x % 2” would be 1, since 13 divided by 2 is 6 with remainder 1.


2 Answers

Suffix ULL to an integer represents type specifier. It means

unsigned long long

You may also like to read this and this one for more detail.

like image 164
haccks Avatar answered Sep 27 '22 18:09

haccks


Those letters modify the literal 1 and make it of type unsigned long long.

This is covered in C99 (ISO/IEC 9899) §6.4.4.1 Integer constants:

integer-suffix:
unsigned-suffix long-suffixopt
unsigned-suffix long-long-suffix
long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt
unsigned-suffix: one of
u U
long-suffix: one of
l L
long-long-suffix: one of
ll LL
like image 29
Brian Cain Avatar answered Sep 27 '22 18:09

Brian Cain