2

次のコードを検討してください

#include<stdio.h>
int fun(); /* function prototype */

int main()
{
    int (*p)() = fun;
    (*p)();  
    return 0;
}
int fun()
{
    printf("IndiaBix.com\n");
    return 0;
}

ここには何がint(*p)()ありますか?それは関数ですか、変数ですか、それとも何ですか?

4

3 に答える 3

6

フロースパイラル ルール:

                 +------+
                 |      |
                 |  +-+ |
                 |  ^ | |            
             int ( *p ) ()
               ^ |    | |
               | +----+ |
               +--------+

               Identifier p
                 is a pointer to..
                 is a pointer to a function  
                 is a pointer to a function returning int
于 2013-09-15T08:14:12.377 に答える
0

int(*p)()-pは、何も受け取らず、 を返す関数へのポインタintです。

したがって、p は c の変数です。

于 2013-09-15T08:12:17.340 に答える