First, let's use cdecl to explain the inner gibberish:
$ cdecl
cdecl> explain (void (*)())
cast unknown_name into pointer to function returning void
So (void (*)()) string
casts string
into a function pointer. Then the function pointer is dereferenced to call the underlying function. The line is equivalent to
void (*fp)() = (*(void (*)()) string)();
(*fp)();
This (on most machines) tries to execute "Hello!" as machine code. It may crash outright on machines with virtual memory because data is often marked as non-executable. If it doesn't crash, it's not likely to do anything coherent. In any case, this is not useful code.
The only thing to learn here is that the cdecl
tool can be useful to understand or write complicated C types and declarations.