Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Wrong value stored in int?
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
araisbec




PostPosted: Tue Mar 09, 2010 8:36 pm   Post subject: Wrong value stored in int?

Hey again! Little problem I'm having that's completely stumping me... I am trying to store a phone number in an int variable (format 9058981760), and when i input 9058981760, the variable stores the value 469047168?? I've never had this problem before, but I'm guessing it has to do with the number being to large to store in the memory?
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: Tue Mar 09, 2010 8:41 pm   Post subject: RE:Wrong value stored in int?

Look up unsigned integers or longs. If your value is not going to be negative, using an unsigned int should allow you to store numbers almost twice as big.
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: