100000000000000000000000 in cpp

Hello there;

i am trying to declare a variable, 10^23 in cpp;
i already tryied:
1
2
3
4
5
6
7
8
#include <stdio.h>
#include <math.h>
int main(void)
{
  unsigned long long int abs = 100000000000000000000000 ;
  printf ("%lf\n",abs);
  return 1;
}

and
1
2
3
4
5
6
7
8
#include <stdio.h>
#include <math.h>
int main(void)
{
  long double abs = 100000000000000000000000 ;
  printf ("%lf\n",abs);
  return 1;
}


but the result is always the same:
error: integer constant is too large for 'long' type

long long double doesnt work :/

thanks for any help.
If you are using too large numbers you can't use basic types, use a library like GMP ( http://gmplib.org/ )
Why are you returning 1 from main? You should return 0
Thank you very much;

about returning 1 : thanks for the advice.
http://www.cplusplus.com/doc/tutorial/variables/
Scroll down to Fundamental data types for reference on what each data type can strore.
Just notice that those values are not always valid:
The values of the columns Size and Range depend on the system the program is compiled for. The values shown above are those found on most 32-bit systems. But for other systems, the general specification is that int has the natural size suggested by the system architecture (one "word") and the four integer types char, short, int and long must each one be at least as large as the one preceding it, with char being always 1 byte in size. The same applies to the floating point types float, double and long double, where each one must provide at least as much precision as the preceding one.

For actual values on your computer use numeric_limits ( C++ ) http://www.cplusplus.com/reference/std/limits/numeric_limits/
or limits macros ( C ) http://www.cplusplus.com/reference/clibrary/climits/
Thanks to everyone; these helped a lot.
Topic archived. No new replies allowed.