幾個C指標的問題總結

來源:互聯網
上載者:User

用變數a給出下面的定義
a) 一個整型數
b)一個指向整型數的指標( A pointer to an integer) 
c)一個指向指標的的指標,它指向的指標是指向一個整型數( A pointer to a pointer to an intege)r 
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 function 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 return 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]; // 一個有10個整型數的數組 An array of 10 integers 
e) int *a[10]; // 一個有10個指標的數組 An array of 10 pointers to integers 
f) int (*a)[10]; // 一個指向有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); // 一個有10個指標的數組,指向一個整形函數並有一個整形參數 An array of 10 pointers to functions that take an integer 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.