Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

About the LONG data type

Why the following is illegal
long number = 234567890*10;
while the following is legal??
long number = 2345678900;
0
helloyip
Asked:
helloyip
  • 2
1 Solution
 
jkrCommented:
The highest value for a signed long is 2^32 ==  2147483648;
By assigning 'number = 2345678900', (which is the same as 'number = 0x8BD03834'), 'number' has the actual value '-1949288396', whilst multiplying '234567890*10' would cause a signed long overflow.
0
 
helloyipAuthor Commented:
tks a lot!!!
0
 
jkrCommented:
Ooops: BTW - what compiler are you using? It should at least issue a warning...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now