Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

In a C++ tutorial this person uses this code: (int)(X + NewX) Can anyone explain to me why the (int) is infront? He doesn't explain that part in his tutorial, but I need to know. Thanks in advance

OpenStudy (asnaseer):

what are the data types for X and NewX? (int) someVariable; basically casts someVariable to an int. e.g. lets say we had: long y = 3L; int x; then you can assign the value of y to x as follows: x = (int) y; you have to be careful with though as you run into problems if the value in y is larger than the maximum int value.

OpenStudy (anonymous):

I always thought there was another way to do it, never knew there was such easy way like this. Thanks for the explanation :)

OpenStudy (asnaseer):

yw

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!