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 ...
随机推荐
- JsonSchmea用法
JsonSchmea用法 简介 JSON Schema是基于JSON格式,用于定义JSON数据结构以及校验JSON数据内容. JSON Schema官网地址:http://json-schema.or ...
- LightOJ 1344 Aladdin and the Game of Bracelets
It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a ...
- 学好linux必须精通用户管理的章节知识
第12章 Linux中用户知识管理 12.1 系统开机启动流程 12.1.1 centos6系统开机启动流程 12.1.1.1 开机系统流程语言描述 服务器电源开关打开 bios自检 目的:检查硬件是 ...
- Django 11
目录 功能配置设计 跨站请求伪造CSRF 什么是CSRF 如果实现CSRF 如何避免CSRF CSRF相关的两个装饰器 auth模块 常用方法 扩展auth_user表中的字段 功能配置设计 实现类似 ...
- 【CSS】271- RGB、HSL、Hex网页色彩,看完这篇全懂了
作者:CSS可乐 http://csscoke.com/2015/01/01/rgb-hsl-hex/ 网页使用到的色彩标示方法中,从古早时期大家都在用的16进位码(#000000).RGB色值标示. ...
- PHP7 break和continue的区别
break:结束当前 for,foreach,while,do-while 或者 switch 结构的执行. continue:在循环结构用用来跳过本次循环中剩余的代码并在条件求值为真时开始执行下一次 ...
- JavaScript数组去重(12种方法,史上最全)
参考博客:https://segmentfault.com/a/1190000016418021?utm_source=tag-newest
- vivado三人表决仿真
概述 下面以三人表决电路的verilog仿真来了解一下vivado软件的使用. 编写设计文件 首先可以在开始的界面通过create new project来新建工程,也可以通过file-->pr ...
- zabbix 监控apache
现在是客户端 1.安装zabbix的rpm源 1 rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4 ...
- 【ES6】函数的扩展
1.函数参数默认值[详情例子参照ESMAScript 6入门 (阮一峰)] 允许为函数的参数设置默认值,即直接写在参数定义的后面.[例子1] 参数变量是默认声明的,所以不能用let或const再次声明 ...