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: 4
size of int pointer: 4
size of float pointer: 4
size of long int pointer: 4
size 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程序打印不同类型的指针变量的大小。相关推荐

  1. c语言 指针不能赋值吗,程序员编程C语言指针答疑:指针赋值没那么简单

    C语言指针,纸老虎 一.程序员编程C语言答疑合集 更多C语言学习答疑文章,请参阅:程序员编程C语言答疑文章合集 也可以加入下方我的"C语言答疑课堂"圈子,第一时间看到我给大家带来的 ...

  2. 关于空指针(指针指向为NULL)和void类型的指针的理解

    正在学C,书上老说空指针,或者说void指针,对于我这样的生手来说,理解非常容易造成混淆,因为void这个单词的意思也是空,到底空指针的意思是指指向地址为空的类型呢,还是指void类型的指针呢 (1) ...

  3. c语言的各种类型的指针,简单总结C语言中各种类型的指针的概念

    2016 这篇文章主要简单总结了C语言中各种类型的指针的概念,指针可以说是C语言本身所具有的最大特性,平时根据不同使用场合习惯地将其简单分类,需要的朋友可以参考下 C语言中有很多关于指针的使用,指针也 ...

  4. ascii非打印控制字符表_C程序打印ASCII表/图表

    ascii非打印控制字符表 什么是ASCII码? (What are ASCII Codes?) ASCII stands for American Standard Code for Informa ...

  5. c语言打印数组元素_C程序打印元素差为0或1的子集数

    c语言打印数组元素 Given an array of integers, find and print the maximum number of integers you can select f ...

  6. javafor循环打印图案_C程序使用循环打印盒子图案

    javafor循环打印图案 Input a number and print the following box pattern in C language, 输入数字并以C语言打印以下框形 , 4 ...

  7. C语言零碎知识点之定义指针时星号靠近类型名还是变量名

    我们在C语言中定义指针时,星号到底是靠近类型名还是变量名有如下几种情况,并且都能够通过编译: int * a;// 星号放在类型名和变量名之间 int* a;// 星号靠近类型名 int *a;// ...

  8. 【二级指针--定义、初始化赋值、解引用;特殊指针--空指针、void类型的指针】(学习笔记12--指针下)

    目录 一.二级指针 指针的指针 二级指针的定义 二级指针的初始化与赋值 二级指针的解引用 二级指针与指针数组 main函数的参数 二.特殊指针 空指针 void类型的指针 新星计划第六篇博文,下面是上 ...

  9. 智能指针的释放_手把手教你实现智能指针

    一. 为什么使用智能指针 C++的内存管理是让很多人头疼的事,因为C++语言中没有垃圾回收机制,当我们通过new语句动态申请堆空间时,用完这个堆空间时就得用delete语句释放申请的堆空间,不然就会导 ...

最新文章

  1. HTTP and HTML
  2. python默认参数 可变对象_当心Python函数可变默认参数(list,set,dict…)的陷阱
  3. wota dance
  4. WPF实现环(圆)形进度条
  5. kali里PHP文件502错误,解决Linux Kali iptables开放22端口失败等一系列问题
  6. java读文件指定行开始到文件的最后
  7. 由儿时的游戏打保猜最广想到的
  8. java wsdl文件生成代码_如何用myeclipse将wsdl文件生成java代码
  9. 领域驱动设计落地经验
  10. win10彻底禁用chrome自动升级方法
  11. 查看linux进程日志,查看linux日志_查看linux日志的方法
  12. 多路视频直播播放器系统框架
  13. java 将doc格式的文档转化为pdf格式(实现Word文件预览)
  14. 服务器怎么用iso文件装系统,u盘使用iso文件安装系统的方法
  15. PS 色调——颜色运算
  16. 机器学习流程(三)-特征工程
  17. 浅析Python中signal包的使用
  18. java hgetall_redis调用 hgetAll方法报错,望迅速解决啊急急急
  19. 在tomcat集群下利用redis实现单点登陆
  20. 如何快速构建用户画像?

热门文章

  1. 服务器物理部署拓扑图,【网络】叶脊(Spine-Leaf)网络拓扑下全三层网络设计与实践(五)-物理服务器路由方案及配置...
  2. 云桌面 瘦终端_小米盒子连接Citrix云桌面
  3. C# 查询一张表的数据用于补充另外一张表的数据 MySQL数据库
  4. es6 语法 (Decorator)
  5. 浏览器拦截打开新窗口情况总结
  6. 写在08年“愚人节”
  7. yum 和 rpm安装mysql彻底删除
  8. Oracle SQL精妙SQL语句讲解(二)
  9. Windows 7 / Vista 分区问题
  10. 系统制成docker镜像_docker镜像原理 镜像制作 dockerfile