top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why unsigned int64_t i gives an error?

+1 vote
482 views

Why the following program gives an error?

#include <stdio.h>

int main() 
{
    unsigned int64_t i = 12;
    printf("%lld\n", i);
    return 0;
}

Error:

 In function 'main':
5:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'i'
  unsigned int64_t i = 12;
               ^
5:19: error: 'i' undeclared (first use in this function)
5:19: note: each undeclared identifier is reported only once for each function it appears in

But, If I remove the unsigned keyword, it's working fine. So, Why unsigned int64_t i gives an error?

posted Jun 19, 2017 by Mahedra Chaudhari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer
  1. These are not standard C notation so you need include stdint.h to compile it.
  2. int64_t is by default a signed one of so you cant apply unsigned to it, to make it unsigned you may need to use uint64_t.

PS: unsigned modifier works only on char, short, int, long, and long long.

answer Jun 19, 2017 by Salil Agrawal
Similar Questions
+1 vote
1)double d=0786; 

2)double d=0x4b17;
+1 vote

Example: consider this string
" Parse this date string 10 juil 2014 @@@parse date " OR "10 juil 2014" (This is easy with SimpleDateFormat using Locale.French) but I want the solution to extract date first from the string and then convert to Date using SimpleDateFormat.

...