answersLogoWhite

0

What do you mean by casting a value?

Updated: 10/19/2022
User Avatar

Wiki User

13y ago

Best Answer

casting a value is when the data type is changed from one type to another.

int a = 100;

float b:

b = (float)a;

------

The (float)a casts an int to a float. In C this is automatic but in C++ it is not. For the sake of readability and debugging it is a good idea to put the cast in the code, this is relay helpful 6 months later when you review your work.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do you mean by casting a value?
Write your answer...
Submit
Still have questions?
magnify glass
imp