Understanding C programming syntax

I came across this syntax and I cannot figure out how to start understanding this.

How to start decoding such a piece of programming code c.

(*(void(*)())0)(); 

I tried to compile this code and compile it without any warnings or errors. SO looks like the correct programming syntax c.

+6
source share
1 answer

Break it as follows:

  • (void(*)()) represents listing 0 . Here it is a pointer to a function with a return type of void and can have any number of arguments.

      ( void (*) ( ) ) ^ ^ ^ | | | | | | | | | | | | + | + Return type | Function | Pointer 
  • *(void(*)())0 dereferences the address 0x00000000 . I think there is a function address there.

  • (*(void(*)())0)(); function call.

+5
source

All Articles