Lecture 13 Flashcards
(2 cards)
0
Q
Online information to seek:
A
http: //www.tutorialspoint.com/cprogramming/c_type_casting.htm
http: //www.cprogramming.com/tutorial/c/lesson11.htm
1
Q
Type Casting:
- What is type casting?
- Why is type casting important?
- How to type cast?
A
- ~changing the type of a variable’s value temporarily to perform an operation
~the variable is unchanged after the operation and type casting - ~you don’t need a separate variable to hold the same value but in a different type
•ex: variable_as_int=1 and variable_as_float=1.0
~you can specify a data type that you need at the time of the operation, this gives you flexibility - ~(new_type) expression
•ex: (float) some_integer