C 中 `%p` 在 printf 中的用途是什麼?
在 C 中,我們已經瞭解了不同的格式說明符。在這裡,我們將看到另一個格式說明符 %p。它用於列印指標型別的資料。讓我們來看一個示例來更好地理解。
示例
#include<stdio.h> main() { int x = 50; int *ptr = &x; printf("The address is: %p, the value is %d", ptr, *ptr); }
輸出
The address is: 000000000022FE44, the value is 50
廣告