how to create 64 bit int, unsigned long long variable with c++



#include <stdio.h>
#include <inttypes.h>


int main(){


  uint64_t x = -10033333000;
  int64_t y =  113333334445533;

  // print x as unsigned variable PRIu64
  printf("value of x is: %" PRIu64 ,x);
  printf("\n");
  // print x as integer variable PRIi64
  printf("value of y is: %" PRIi64,y);
  printf("\n");


  // this is the same like y
  unsigned long long z = -212121212121;
  printf("value of z is: %llu",z,"\n");
  printf("\n");


  return 0;
}

gcc  int64bit.c -o int64bit
int64bit.c: In function ‘main’:
int64bit.c:8: warning: integer constant is too large for ‘long’ type
int64bit.c:9: warning: integer constant is too large for ‘long’ type
int64bit.c:18: warning: integer constant is too large for ‘long’ type
rex@ubuntu:~/cpp$ ./int64bit
value of x is: 18446744063676218616
value of y is: 113333334445533
value of z is: 18446743861588339495






Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Use <pre> all your html php come here </pre> for your code
  • Allowed HTML tags: <a> <b> <pre> <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <div> <style><img> <br> <blockquote>
  • Lines and paragraphs break automatically.
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.