C lang: Pointer
Ax_Terminology
xa_pointer
pointer is the address used to store the variable;A variable (or data object) whose value is a memory address
Bx_Operator
xa_indirection operator(*)
xb_address operator(&)
Cx_Program
xa_not use pointer
#include <stdio.h>
void verse(int u,int k);
//// main function ////
int main(void)
{
int a = 1, b = 10;
printf("one : %d %d\n",a ,b);
verse(a, b);
printf("one : %d %d\n",a ,b);
return 0;
}
//// exchange function ////
void verse(int u,int k)
{
int o;
printf("%d %d\n", u, k);
o = u;
u = k;
k = o;
printf("%d %d\n", u, k);
}
//one do not exchange

xb_use pointer
#include <stdio.h>
void verse(int * u, int * y);
//// main ////
int main(void)
{
int x = 5, y = 10;
printf("before x >> %d y >> %d\n", x, y);
verse(&x, &y);
printf("now x >> %d y >> %d\n", x, y);
return 0;
}
//// exchange /////
void verse(int * u, int * y)
{
int odd;
odd = *u;
*u = *y;
*y = odd;
}

C lang: Pointer的更多相关文章
- C lang:Pointer and multidimensional array
Xx_Introduction Double indrection:Address of Address;Pointer of Pointer Ax_Code #include<stdio.h& ...
- C lang:Pointer operation
Xx_Pointer opteration Do not dereference initialized Pointers Ax_Code #include<stdio.h> int ma ...
- C lang:Pointer and Array
Xx_Introduction Point and Array germane. Xx_Code #include<stdio.h> #define SIZE 4 int main(voi ...
- JDK1.6 Java.lang.Null.Pointer.Exception
先来看一下JDK1.6的API: NullPointerException (Java Platform SE 6) public class NullPointerException extends ...
- C lang:Array and Pointer formal parameter
Test Xx_Formal parameter Formal parameter are local variable. It's private to the function. Ax_Array ...
- J2SE 1.6 特性:java.lang.instrument
1. import java.lang.instrument.Instrumentation; public class ObjectSizeFetcher { private static Inst ...
- 横向文本框 cursor:pointer 出现手型
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- java.lang.instrument: 一个Java对象占用多少字节?
一.对象头包括两部分信息:Mark Word(标记字段)和 Klass Pointer(类型指针) 1. Mark Word 用于存储对象自身的运行时数据,如哈希码(HashCode).GC分代年 ...
- spring quartz job autowired 出错 null pointer
什么情况下才能用autowired? 当当前类属于spring IOC容器管时候就可以,比如在applicationContext.xml里有定义 就是说在spring上下文里能够找到 但是比如qua ...
随机推荐
- JavaScript的函数申明、函数表达式、箭头函数
JavaScript中的函数可以通过几种方式创建,如下. // 函数声明 function getName() { return 'Michael' } // 函数表达式 const getName ...
- MyBatis框架的基本配置
MyBatis的基本配置文件: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE config ...
- CF595 Div31249A,1249B1,1249B2,1249C1,1249C2,1249D1,1249D2,1249E,1249F)题解
A:水题,先排序,有相连的输出2,否则输出1. #include<bits/stdc++.h> using namespace std; #define pii pair<int,i ...
- (全国多校重现赛一)D Dying light
LsF is visiting a local amusement park with his friends, and a mirror room successfully attracts his ...
- CodeForces1006C-Three Parts of the Array
C. Three Parts of the Array time limit per test 1 second memory limit per test 256 megabytes input s ...
- iSensor APP 之 摄像头调试 MT9D001 MT9P031 测试小结 200万像素和500万像素摄像头
iSensor APP 之 摄像头调试 MT9D001 MT9P031 测试小结 iSensor app 非常适合调试各种摄像头,已测试通过的sensor有: l OV7670.OV7725.OV ...
- FPGA_VIP_V101 摄像头视频采集 调试总结之SDRAM引起的水平条纹噪声问题
FPGA_VIP_V101 摄像头视频采集 调试总结之SDRAM引起的水平条纹噪声问题 此问题困扰我很近,终于在最近的项目调整中总结了规律并解决了. 因为之前对sdram并不熟悉,用得也不是太多,于是 ...
- python学习-class封装
# 封装 类=属性+行为 抽像 -class StudentV2: # 类属性 所有的实例可以共享 .不属于任何实例的特性. is_people = True # 类方法 1.装饰器.2.参数是cls ...
- .NET Core环境变量和用户秘钥实现开发中的数据安全
目录 一.注入 IConfiguration 二.从配置文件 appsettings.json 中获取环境变量 三.从项目中获取环境变量 四.用户秘钥设置环境变量 前言:有很多人将秘钥,数据库连接字符 ...
- 语句知识总结(js)
函数声明语句和函数定义表达式有什么不同 首先看一下函数声明语句和函数定义表达式的例子,表达式会返回一个值,而语句就是js中的一整句,下面例子中第6行是函数声明语句,第10行是函数定义表达式. f(); ...