日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c 指针打印变量_C程序打印不同类型的指针变量的大小。

發布時間:2023/12/1 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c 指针打印变量_C程序打印不同类型的指针变量的大小。 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

c 指針打印變量

Any type of pointer variable takes the same memory bytes in the memory, because they are used to store the memory addresses on other type of variables.

任何類型的指針變量都在內存中占用相同的內存字節,因為它們用于在其他類型的變量上存儲內存地址。

Let’s take an example - There are two pointers 1) integer pointer and 2) char pointer, integer pointer will take 4 bytes (in case of, 32 bits compiler) and will store the address of integer variables only. char pointer will also take 4 bytes but it will store the address of only char variable.

讓我們舉個例子 -有兩個指針1) 整數指針和2) char指針 ,整數指針將占用4個字節(對于32位編譯器而言),并將僅存儲整數變量的地址。 char指針也將占用4個字節,但它將僅存儲char變量的地址。

In this C program, we are testing the same by printing the size of different types of pointers.

在此C程序中,我們通過打印不同類型的指針的大小來進行測試。

C程序打印不同類型指針的大小 (C program to print sizes of different type of pointers )

</ s> </ s> </ s> /*C program to print size of different types of pointer variables.*/ #include <stdio.h>int main() {printf("\nsize of char pointer: %d" ,sizeof(char*));printf("\nsize of int pointer: %d" ,sizeof(int*));printf("\nsize of float pointer: %d" ,sizeof(float*));printf("\nsize of long int pointer: %d" ,sizeof(long int*));printf("\nsize of double pointer: %d\n" ,sizeof(double*));return 0; }

Output

輸出量

size of char pointer: 4size of int pointer: 4size of float pointer: 4size of long int pointer: 4size of double pointer: 4

~~~~ Output depends on the system architecture,
~~~~ but each type of pointer will take same memory space ~~~

~~~~輸出取決于系統架構,
~~~~但是每種類型的指針都會占用相同的內存空間~~~

翻譯自: https://www.includehelp.com/c-programs/c-pointer-program-to-print-size-of-different-types-of-pointer-variables.aspx

c 指針打印變量

總結

以上是生活随笔為你收集整理的c 指针打印变量_C程序打印不同类型的指针变量的大小。的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。