answersLogoWhite

0

Casting is used when you want to save a value of one type to a variable which is of a different type. Below are a couple of different examples:

Example 1:

double d = 3.6;

int i = (int) d;

Example 2:

int i = (int) 29.4;

Care must be taken when casting as detail is lost. In the first example above, the new value of 'i' would be 3. This means that any number with a decimal point will automatically loose anything after the decimal point (basically, it will be rounded down).

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Other Engineering
Related Questions

Is there a technical term for actors that are typecast in the same role?

no


What is meant by the term typecast?

Typecast is a term used in acting to describe the action in which an actor is portrayed as the same or similar character. It can be difficult for actors to step outside the role in which they are "typecasted".


Why did Phyllis Logan quit the role of Lady Jane Felsham?

typecast


What are the release dates for Half and Half - 2002 The Big Typecast Episode 2-17?

Half and Half - 2002 The Big Typecast Episode 2-17 was released on: USA: 29 March 2004


What actors and actresses appeared in Typecast - 2006?

The cast of Typecast - 2006 includes: Ludovic Balland as himself Steff Geissbuhler as himself Manuel Krebs as himself Wolfgang Weingart as himself Cornel Windlin as himself


Words beginning with typ?

Words beginning with 'typ' are: type typewriter typecast typeface typescript typeset typesetter typestyle typography typist typographical error typhoid typhoon typhus typical typify


Words beginning with type?

Words beginning with 'type' are: type typewriter typecast typeface typeset typesetter typestyle


When should not type cast used?

Example for pointless typecast: char *p, *q; p= (char *)q;


Can a union be used in c to convert an integer into a double?

No, but a typecast can: int n; double d; d= (double)n;


How was bela lugosi typecast?

He was famous for his role as Count Dracula, and afterwards found it difficult to find any roles besides horror.


Did Ian Mckellen play Albus Dumbledore?

No, official line was that he didn't want to by typecast as a wizard after playing Gandalf in the LOTR trilogy.


First argument of fwrite function is typecast to?

void * wlen= fwrite ((void *)&data, 1, sizeof (data), file); if (wlen != sizeof (data)) ... error ...