Actions

EmSys

C - Explicit type conversion

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Explicit type conversion

  • Explicit type conversion is forced by the programmer, where automatic type conversion cannot be done by the compiler.
float f1, f2;
int i = 10;
f1 = f2 = 20.713489;
i = (int)(f1 + f2);
// The sum of f1 and f2 is explicitly converted to an int.