Ivan Prodanov
Ivan Prodanov

Reputation: 35532

What is double(C++) in C#?

What is the double type(C++) in C#?

double experience;

At first,I thought its UInt32,but its not. How to declare it in C#?

Upvotes: 2

Views: 6262

Answers (6)

JaredPar
JaredPar

Reputation: 755229

This is a question that is dependent upon the particular C++ compiler implementation you are using. The double type can be either 4 or 8 bytes according to the C++ standard. Most compilers do use 8 bytes though. Here are the closest representations

  • 4 bytes: float
  • 8 bytes: double

Reference: http://msdn.microsoft.com/en-us/library/cc953fe1.aspx

Upvotes: 16

Matt Grande
Matt Grande

Reputation: 12157

I don't remember much about C++, but there is a double type in C#.

If you just want larger whole numbers, though, look at long.

Upvotes: 1

Adam Robinson
Adam Robinson

Reputation: 185663

Not sure what the question is. A double in C# is the same as a double in C++. double is not an integral number in any mainstream language that I'm aware of.

Upvotes: 1

Daniel Brückner
Daniel Brückner

Reputation: 59685

It is just double or Double. More specific double is a C# specific alias for System.Double.

Upvotes: 3

Jonathan Rupp
Jonathan Rupp

Reputation: 15772

C# has the double type as well.

double experience;

should compile and work just fine in C#.

Upvotes: 0

jgallant
jgallant

Reputation: 11273

Double in C# is Double.

double var1 = 0.123;

Upvotes: 1

Related Questions