printf函數中%p代表什麼資料類型,printf%p

來源:互聯網
上載者:User

printf函數中%p代表什麼資料類型,printf%p

今天在問答頻道看到網友問%p輸出的是什麼,查了查在這裡做個記錄


<span style="font-size:18px;">#include <stdio.h>void main(){int arr[5] = {10,20,30,40,50};int i = 0; printf("資料:\n");printf("十進位表示的資料:\n");for(i = 0 ; i < 5 ; i++){printf("%d\t",arr[i]);}printf("\n\n指標形式十六進位表示的資料:\n");for(i = 0 ; i < 5 ; i++){printf("%p\t",arr[i]);}printf("\n\n普通十六進位表示的資料:\n");for(i = 0 ; i < 5 ; i++){printf("%x\t",arr[i]);}printf("\n\n\n\n地址:\n");printf("\n\n十進位表示的地址:\n");for(i = 0 ; i < 5 ; i++){printf("%d\t",&arr[i]);}printf("\n\n指標形式十六進位表示的地址:\n");for(i = 0 ; i < 5 ; i++){printf("%p\t",&arr[i]);}printf("\n\n普通十六進位表示的地址:\n");for(i = 0 ; i < 5 ; i++){printf("%x\t",&arr[i]);}}</span>


資料:
十進位表示的資料:
10      20      30      40      50


指標形式十六進位表示的資料:
0000000A        00000014        0000001E        00000028        00000032




普通十六進位表示的資料:
a       14      1e      28      32






地址:




十進位表示的地址:
1244980 1244984 1244988 1244992 1244996


指標形式十六進位表示的地址:
0012FF34        0012FF38        0012FF3C        0012FF40        0012FF44




普通十六進位表示的地址:
12ff34  12ff38  12ff3c  12ff40  12ff44  Press any key to continue

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.