面試驗:C語言經典面試題(C語言面試題分析之五)

來源:互聯網
上載者:User

面試驗:C語言經典面試題

C語言面試題分析之五

一.    關於C語言指標的經典面試題

a) 一個整型數(An integer)
b) 一個指向整型數的指標(A pointer to an integer)
c) 一個指向指標的指標,它指向的指標是指向一個整型數的(A pointer to a pointer
to an integer)
d) 一個有10個整型數的數組(An array of 10 integers)
e) 一個有10個指標的數組,該指標是指向一個整型數的(An array of 10 pointers to
integers)
f) 一個指向有10個整型數數組的指標(A pointer to an array of 10 integers)
g) 一個指向函數的指標,該函數有一個整型參數並返回一個整型數(A pointer to a fu
nction that takes an integer as an argument and returns an integer)
h) 一個有10個指標的數組,該指標指向一個函數,該函數有一個整型參數並返回一個整型
數( An array of ten pointers to functions that take an integer argument and r
eturn an integer )

答案是:
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 int
eger argument and return an integer

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.