Questions tagged [unsigned-long-long-int]

unsigned long long int specified in the C99 standard

unsigned long long long int is at least 64-bit in size and was specified in the C99 standard. It is the same as long long but unsigned.

162 questions
0
votes
2 answers

where should I use ULL in after variables?

I was trying to solve a question on codeforces . I have to give input 1000000000 1000000000 1 to this code #include using namespace std; int main() { long n,m,a; cin >> n >> m >>a ; long b,c; b = (n%a==0)?(n/a):((n/a)+1); c =…
0
votes
0 answers

C get percentage of ULLONG_MAX reliably

In C, the following gives me an implicit conversion warning. I know why this warning happens. What I want to know is if there's a reliable one liner way of getting the percentage of really large unsigned numbers. I know that the end result will fit…
0
votes
1 answer

How to serialize unsigned int / long values in AVRO

I am trying to serialize data with unsigned values to AVRO, but I see only signed int, long, float and double are supported by the AVRO libraries. I could not find any native support for unsigned values in AVRO libraries. Can you please help me in…
No8
  • 77
  • 1
  • 9
0
votes
4 answers

How to convert unsigned char* to unsigned long long int?

Does anyone know of a library that provides a function that performs this logic or perhaps a method to perform this logic? I'm trying to convert: unsigned char test[] = "\x00\x00\x56\x4b\x7c\x8a\xc5\xde"; to: 94882212005342 /…
0
votes
1 answer

C++ wrong result in multiplication of two unsigned long long integers

Consider the multiplication of the following unsigned long long integers: unsigned long long a=4294967297; unsigned long long b=4294967297; cout<
Kagaratsch
  • 963
  • 8
  • 18
0
votes
1 answer

X86 architecture - Set Vector size with unsigned long long

When I am trying to set vector size with unsigned long long in x86 architecture, I am seeing below error: unsigned long long sz; vec.resize(sz); error C4244: 'argument': conversion from 'unsigned __int64' to 'const unsigned int', possible loss of…
Mounika
  • 371
  • 4
  • 18
0
votes
1 answer

What is the equivalent of BinaryWriter.Write() from C# in Python?

So I have this function in a C# program: public void Write(BinaryWriter writer) { writer.Write(0x6369676F6C6572uL | ((ulong)Type << 56)); writer.Write(Revision); writer.Write((ulong)(int)((uint)IsFavorite.ToInt() & 1u)); …
0
votes
1 answer

Why does C interpret unsigned short int as unsigned long?

In this main function, I get an error message that I should not use %hu (format specifier for unsigned short), and that the type of unsigned short appears to be unsigned long. How could that be the case? #include int main (void) { …
0
votes
0 answers

Is there any difference between size_t and unsigned long long?

I am a bit confused about the difference between size_t and unsigned long long. Is there any difference between them at all? Also when printing or scanning a size_t object for input/output, will it be appropriate to use %llu (unsigned long long's…
0
votes
1 answer

What is the best way to ensure a user only enters natural numbers?

Just started learning C, and it would be great if you could help me with the following: I just wrote a program that calculates the factorial of a natural number entered by the user. If the number is negative or a character, it should notify the user…
Henry
  • 697
  • 1
  • 6
  • 16
0
votes
0 answers

How to store/assign value to a data type greater than it's range

I wrote a simple code to print the simple series where the current number multiply with the previous number. #include using namespace std; int main() { int n, i; unsigned long long result = 1; std::cout << "please enter…
0
votes
0 answers

Managing unsigned long long via hashtable

I'm looking for a solution on how to manage (accumulate, search, sort) hundreds of thousands of unsigned long long. Basically, I need to collect a number of hits for each hash represented as unsigned long long, then sort the list and get the top…
Greg
  • 137
  • 2
  • 11
0
votes
0 answers

Use of long long int in 2D Array

What is the meaning of "Grid[i][1] = 1LL" in the following code? typedef long long int ll; ll Grid[10][10]; for(i=1;i<4;i++) { if(Grid[i][1] == 0) { Grid[i][1] = 1LL; } else break; }
0
votes
1 answer

(C) i'm seemingly overflowing despite values being an order of magnitude below the size of the variable

so i'm writing code for a project in an introductory class to C (converting decimals to binary) and have decided to store the binary as a decimal rather than use an array of digits. the program runs fine for numbers up to 1023, and the gives me a…
Aerbon
  • 13
  • 2
0
votes
1 answer

Multiplying very large hex numbers and printing them in C

I want to multiply 2 very big hex numbers and print them out like for example: 28B2D48D74212E4F x 6734B42C025D5CF7 = 1068547cd3052bbe5688de35695b1239 Since I expected it to be a very big number I used unsigned long long int type: unsigned long…
cheshire
  • 1,109
  • 3
  • 15
  • 37