[Solved] No More Confusing Pointers


  • Point 1: Nested functions are not standard C. They are supported as GCC extension..

  • Point 2: printf("&b is:%s\n",&b); is wrong and invokes UB, because of improper format specifier. You need to change that to

     printf("&b is:%p\n",(void *)&b);
    
  • Point 3: &(&a) is wrong. the operand for & needs to be an lvalue, not another address, which is not an lvalue.

    Related: C11, chapter ยง6.5.3.2, for the operand type

    The operand of the unary & operator shall be either a function designator, the result of a [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is not declared with the register storage-class specifier.

    and the return type

    ….result is not an lvalue.

solved No More Confusing Pointers