24
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....

Grijesh Chauhan
  • 57,103
  • 20
  • 141
  • 208
user2608075
  • 259
  • 1
  • 2
  • 4
  • Unsigned Long long `ULL` suffix – Grijesh Chauhan Jul 22 '13 at 19:24
  • Who is upvoting this??? –  Jul 22 '13 at 19:26
  • 9
    @H2CO3: I am, for instance. Just because the answer is easily googled, it doesn't meant that it's a bad question. – Nathan Fellman Jul 22 '13 at 19:27
  • 3
    @H2CO3: Note that unlike in the linked "duplicate", the use of the suffix in the code here is significant and likely required (e.g. if `int` is 32 bits, the code would malfunction if the prefix were omitted and `length` could be 16 or larger). – supercat Jul 22 '13 at 19:29
  • Being new to C (more comfortable with Python), I did not recognize this "1ULL" expression as the combination of a numeric literal and type suffix. Visually, it looks more like "NULL" than it looks like "1". The specific form of this question was helpful to me; the marked duplicate did not show up when searching. – David Brown Dec 24 '21 at 15:39
  • I'm upvoting this, as this version of the question is clearer and completer. Not a reason for an upvote, but it was also the first google Result I got. – Erik Bongers Jan 26 '22 at 10:39

3 Answers3

20

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.

Community
  • 1
  • 1
haccks
  • 104,019
  • 25
  • 176
  • 264
9

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
Brian Cain
  • 14,403
  • 3
  • 50
  • 88
6

It's a way to signal to the compiler that the value must be considered as a unsigned long long.

nouney
  • 4,363
  • 19
  • 31