-7

I am new to programming. While i'm browsing for datatypes i found many data types,i understood all the other data types except signed and unsigned data types. can any one help me by giving real life examples for using signed,unsigned int,long,short data types.

Pleotex
  • 42
  • 9
  • what does realtime has to do with data type? – Sourav Ghosh Jun 23 '16 at 18:53
  • Does this question duplicate (http://stackoverflow.com/questions/3724242/what-is-the-difference-between-int-and-uint-long-and-ulong) – wake-0 Jun 23 '16 at 18:53
  • 2
    This is not a tutorial service for the fundamentals of programming. Visit MSDN for details on datatypes. See [Ask] and take the [Tour] to learn what is acceptable to post here. Also C and C# are 2 different languages – Ňɏssa Pøngjǣrdenlarp Jun 23 '16 at 18:53
  • 1
    @Plutonix: MSDN is not a good reference for C code, as they don't support the standard. There are other sites which do, though. – too honest for this site Jun 23 '16 at 19:46
  • 1
    I assume instead of "real time", you mean "real life examples" of when you could use "unsigned" vs "signed" integers. An example of "unsigned" could be a variable specifying "years since birth" (i.e. years old)... You could safely use unsigned because "negative years since birth" is not possible. Whereas, if an integer variable could represent either a positive value or a negative value, then it should be signed. – TonyB Jun 23 '16 at 20:51

1 Answers1

1

Use signed int for some number that is conceptually a difference or can have a negative value for example the difference in distances.

Use unsigned int for some number that can only have positive value for example speed.

Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424