美文网首页C++ 杂记
C++ 用变量a给出下面的定义

C++ 用变量a给出下面的定义

作者: 赵者也 | 来源:发表于2017-01-02 19:54 被阅读22次

    用变量a给出下面的定义:
    a) 一个整型数

    b)一个指向整型数的指针

    c)一个指向指针的的指针,它指向的指针是指向一个整型数

    d)一个有10个整型数的数组

    e) 一个有10个指针的数组,该指针是指向一个整型数的

    f) 一个指向有10个整型数数组的指针

    g) 一个指向函数的指针,该函数有一个整型参数并返回一个整型数

    h) 一个有10个指针的数组,该指针指向一个函数,该函数有一个整型参数并返回一个整型数

    答案是:
    a) int a; // An integer
    b) int *a; // A pointer to an integer
    c) int a; // A pointer to a pointer to an integer
    d) int a[10]; // An array of 10 integers
    e) int a[10]; // An array of 10 pointers to integers
    f) int (
    a)[10]; // A pointer to an array of 10 integers
    g) int (
    a)(int); // A pointer to a function a that takes an integer argument and returns an integer
    h) int (
    a[10])(int); // An array of 10 pointers to functions that take an integer argument and return an integer

    相关文章

      网友评论

        本文标题:C++ 用变量a给出下面的定义

        本文链接:https://www.haomeiwen.com/subject/vyzwvttx.html