I have seen this type of ad many times and have no idea what it does:
*(type*)$var
eg:
*(char *)&myChar
If the address myCharis retrieved and a pointer is sent to it char, then why is the extra pointer outside and why is it an address, which is possibly an int value or a hex value as a pointer? It makes no sense to me. I'm a newbie, so please explain step by step what is happening here and why use this confusing format for type casting. Thank.
myChar
char
myChar, char*, , , , , . , .
char*
int x; char c = *(char*)&x;
x int, char. 1 , char 1 .
x
int
, . 4 ( , int 4 ) , . ++ .
*(type *)&var - C- .
*(type *)&var
,
char buf[4]; *(uint32_t *)&buf = 32;
32 buf.
buf
. . , . . !
Source: https://habr.com/ru/post/1543941/More articles:Оптимизация петли в C - optimizationShorthand array initializer with optional values in Swift - arraysHow to quickly create a VTCompressionSession? - objective-cApple Swift: initialize array of general type - arraysHow does "flash" in Rails make a global application? - ruby | fooobar.comneed an example of cropping an image in an Android application - androidUpdating Java strings using Jackcess - javaProblems of horizontal packaging layout - javascriptDataGridTemplateColumn Header Binding - c #Pry gives a bunch of warnings - rspecAll Articles