-6

As far as I know, double type in C is used to store floating-point numbers (e.g. 13,54201) and int type is for integers that can be negative (e.g. -44), now I'm writing a program and I need to store negative and floating-point values (e.g. -44,54201).

which data type should I use ?

Reda LM
  • 191
  • 1
  • 2
  • 10
  • Are you storing a floating-point value or an integer value? Do you *know* what "signed" means? Perhaps you should get [a good beginners book or two](http://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list) to read? – Some programmer dude Nov 24 '17 at 14:55
  • 1
    "A signed integer is one with either a plus or minus sign in front. That is it can be either positive or negative. An unsigned integer is assumed to be positive." You should google some stuff before posting questions. – josemartindev Nov 24 '17 at 14:57
  • 1
    The `double` type can store -44.54201 to a good level of precision. Note that C source code uses the `.` character to separate the integer part from the fraction part of a number in a _floating point_ constant, irrespective of the separator used in your locale. – Ian Abbott Nov 24 '17 at 15:01
  • sorry for my bad english I just edited the question – Reda LM Nov 24 '17 at 15:11
  • The `double` type can be used to store negative numbers. Where is the problem? – Jabberwocky Nov 24 '17 at 15:16

1 Answers1

0

It seems you have your terminology mixed up. What you're calling "signed" numbers are actually called fractional numbers.

So what you're really asking for is a datatype that hold values that are both fractional and negative. The double type can do just that.

dbush
  • 205,898
  • 23
  • 218
  • 273