c 2b 2b casting

Solutions on MaxInterview for c 2b 2b casting by the best coders in the world

showing results for - "c 2b 2b casting"
Klara
16 Feb 2017
1static_cast<int>(some_double);
Erwann
02 May 2017
1static_cast:
2//does implicit conversions between types.
3void* data;
4pointer *pData = static_cast<pointer*>(data);
5
6const_cast:
7//this can be used to remove or add the const to a variable.
8const char* characters;
9const_cast<char*>(characters);
10
11reinterpret_cast:
12//this cast is dangerous since it turns one type directly into another.
13struct S1 { int a; } s1;
14int* p1 = reinterpret_cast<int*>(&s1);