-4
Float a;
int i=(Int) a;
Int& j=(Int &) a;

Can't type with extensive details using my phone.
Can anyone tell thx

Update: Not quite you Lot expected. Since Google was completely banned here in China. I can barely login using laptop. Always popping message like require third party JavaScript. typing Is hard. so that's it and to the one claims this a simple reference, incomplete i think. It's more complicated than that

Update: Best just change title. Seems casting to different type could cause problems. So what's different between the two processes of different typecast.

Last update: Experimented, why i and j are different. Don't vow down if you can't answer yourself

scoof
  • 23
  • 3
  • First casts to `int`, second casts to a reference to `int` – masoud Jan 27 '15 at 08:42
  • 10
    *"Can't type with extensive details using my phone."* Why do you need to type on your phone? Are you sitting an exam right now? – Baum mit Augen Jan 27 '15 at 08:42
  • 3
    Neither `Float` nor `Int` are things in C++. – juanchopanza Jan 27 '15 at 08:42
  • The device you are using is irrelevant to us. Stack Overflow has its guidelines and you must follow them. – Daniel Daranas Jan 27 '15 at 09:21
  • possible duplicate of [When should static\_cast, dynamic\_cast, const\_cast and reinterpret\_cast be used?](http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used) – Suma Jan 27 '15 at 09:36
  • Tell what? `int` and `int&` are totally different things. It is not really possible to post a tutorial about references here. Perhaps you should start with a good C++ book. – n. m. could be an AI Jan 27 '15 at 10:13

1 Answers1

-2

(int) will cast the float value to sizeof(int) byte integer value <= float value

(int &) will convert the float value to a one byte refrence

Alireza Soori
  • 645
  • 9
  • 25