C lang:Pointer and Array
Xx_Introduction
Point and Array germane.
Xx_Code
#include<stdio.h>
#define SIZE 4
int main(void)
{
short arra[SIZE];
short * a;
double arrb[SIZE];
int i;
double * b;
a = arra;
b = arrb;
for (i = 0; i < SIZE; i++)
printf("%d %p %p \n",i ,a + i,b + i);
return 0;
}
Ax_Address and Value
dates + 2 == &dates[2]; //true address
*(dates + 2) == dates[2]; //true value
*dates + 2 = (*dates) + 2; // Beause '*' > '+'
<<<<<<<<<<"I am the dividing line ">>>>>>>>>>>>
Bx_Replace
x-a not use pointer
#include<stdio.h>
#define M 12
int main(void)
{
int days[M] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int i;
for (i = 0; i < M; i++)
printf("Month %2d has %2d days.\n", i + 1, days[i]);
return 0;
}
x-b use pointer
#include<stdio.h>
#define M 12
int main(void)
{
int days[M] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int i;
for (i = 0; i < M; i++)
printf("Month %2d has %2d days.\n", i + 1, *(days + i)); // equal to days[i]
return 0;
}
x-c Notice
V.V(vice versa)Use arrays to represent Pointers,but attention to
When an array is a function of an argument.
C lang:Pointer and Array的更多相关文章
- C lang:Pointer and multidimensional array
Xx_Introduction Double indrection:Address of Address;Pointer of Pointer Ax_Code #include<stdio.h& ...
- Go: using a pointer to array
下面的不是指针指向数组,而是指针指向Slice I'm having a little play with google's Go language, and I've run into someth ...
- c pointer and array
Pointer: A pointer is a variable that contains the address of a variable. if c is a char and p is a ...
- C lang:Pointer operation
Xx_Pointer opteration Do not dereference initialized Pointers Ax_Code #include<stdio.h> int ma ...
- C lang: VLA(variable-length array)
Xx_VLA Introduction VLA:variable-length array,not variable array size,but variable arary dimensional ...
- C lang: Pointer
Ax_Terminology xa_pointer pointer is the address used to store the variable;A variable (or data obje ...
- The correct way to initialize a dynamic pointer to a multidimensional array
From:https://stackoverflow.com/questions/18273370/the-correct-way-to-initialize-a-dynamic-pointer-to ...
- initial pointer [expert c]
initial differece between pointer and array Both arrays and pointers can be initialized with a liter ...
- Reflection and array
java.lang.Reflect.Array类提供了动态创建和访问数组元素的各种静态方法. package com.sunchao.reflection; import java.lang.refl ...
随机推荐
- luogu P1316 丢瓶盖 |二分答案
题目描述 陶陶是个贪玩的孩子,他在地上丢了A个瓶盖,为了简化问题,我们可以当作这A个瓶盖丢在一条直线上,现在他想从这些瓶盖里找出B个,使得距离最近的2个距离最大,他想知道,最大可以到多少呢? 输入格式 ...
- 使用 Zookeeper 的 Api 实现服务注册
创建常量接口 com.bjsxt.constant.Constants package com.bjsxt.constant; public interface Constants { //访问Zoo ...
- 使用flatbuffers
问题 张三是个java程序员,他写产生数据的程序.李四是个python程序员,他要用python处理张三产生的数据.最直观常用的方法就是张三用java把产生的数据保存成csv或者xml文件,然后李四用 ...
- VMware虚拟机安装Linux(CentOS)系统
vmware workstation 虚拟机官方下载路径:https://www.vmware.com/cn/products/workstation-pro/workstation-pro-eval ...
- 【VUE】自定义组件
[VUE]自定义组件 转载: ============================================ ======================================== ...
- 备战“金九银十”10道String高频面试题解析
前言 String 是我们实际开发中使用频率非常高的类,Java 可以通过 String 类来创建和操作字符串,使用频率越高的类,我们就越容易忽视它,因为见的多所以熟悉,因为熟悉所以认为它很简单,其实 ...
- 一遍文章搞清楚VO、DTO、DO、PO的概念、区别
作者:Cat Qi 概念: VO(View Object):视图对象,用于展示层,它的作用是把某个指定页面(或组件)的所有数据封装起来. DTO(Data Transfer Object):数据传输对 ...
- 多个datasource的配置与实现原理
一般情况下,一个项目中只会有一个datasource,但是在某些情况.或者业务需求的情况下会出现一个项目有多个datasource的情况,当满足一定条件的时候,对数据库的操作就会从一个一个 ...
- 新安装mariadb远程登陆配置及相关问题排查
前言: 安装过程不再赘述,直接说问题,mysql的远程连接需要解决两个问题:1.允许root用户远程连接.2.允许任意ip远程连接数据库.当然,在测试和解决问题之前,得首先保证你的数据库与远程主机之间 ...
- nginx代理grafana
希望通过Nginx为服务器上的grafana进行代理,实现通过在当前域名后加/grafana在公网进行访问,开始按照百度的方法弄了几个小时都不行,后面仔细看了官方的文档才弄好,Mark一下. Ngin ...