Hi Frens,
What is actually casting and why it needed?
for example :
* (int *) x;
Can someone explain me in detail about it?
Hi Frens,
What is actually casting and why it needed?
for example :
* (int *) x;
Can someone explain me in detail about it?
A cast is an explicit conversion from one data type to another. Sometimes such things are trivial, such as converting -40 from Fahrenheit to Celcius -- or in many situations from one pointer to another. Other times it is nontrivial (although maybe implicit), such as converting an integral to a floating point type.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Code:double x = 0.0; int y = (int)x;
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.