F D

F D

  • NA
  • 45
  • 69.6k

C Sharp Intrinsic Types

Jan 25 2011 5:38 PM

Maybe someone can clarify for me. I'm a bit confused.

 

The question is which type should each of the following be and determine which should be represented with a constant

 

-Your age in years (I chose byte b/c of it being an unsigned value up to 255 thus using less memory, but my book (Learning C Sharp 3.0 by O"reilly) said short)

I can't make sense out of this. Could it be if the values of my age and others ages totaling more than 255, therefore needing more memory?  

 

-Speed of Light in meters per second (299,792,458)  - Couldn't quite figure this out so I said to make this a constant & long, book said constant & float.

I'm ok, but not 100% on this one. I understand the float as far as precision is concerned, but then why not a double? Could it be potential memory being wasted?  

 

Any information would be greatly appreciated.

 

Thanks.


Answers (2)