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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Type Casting:

  1. What is type casting?
  2. Why is type casting important?
  3. How to type cast?
A
  1. ~changing the type of a variable’s value temporarily to perform an operation
    ~the variable is unchanged after the operation and type casting
  2. ~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
  3. ~(new_type) expression
    •ex: (float) some_integer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly