Click to See Complete Forum and Search --> : type transfer


ncs
April 5th, 2002, 10:17 AM
In C++ can you go from a larger type to a smaller type. Example

long lg;
int in;

lg = 89;
in = lg;

Is this legal or will the compiler give an error????

ncs
April 5th, 2002, 10:17 AM
In C++ can you go from a larger type to a smaller type. Example

long lg;
int in;

lg = 89;
in = lg;

Is this legal or will the compiler give an error????

NMTop40
April 5th, 2002, 11:47 AM
no. and on Windows int is the same size as long. But you may get a warning when it is shorter.


The best things come to those who rate