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 ...
随机推荐
- DRF Django REST framework 之 序列化(三)
Django 原生 serializer (序列化) 导入模块 from django.core.serializers import serialize 获取queryset 对queryset进行 ...
- 洛谷 题解 P3173 【[HAOI2009]巧克力】
本蒟蒻又双叒叕被爆踩辣! 又是一道经典的贪心题: 那么怎样切割该块巧克力,花费的代价最少呢? Solution: 窝们考虑每个状态,有多少种选择方法? 是不是可以选择横着切或者竖着切,就这两种方法吧: ...
- iOS开发-KVO的奥秘
转自:http://www.jianshu.com/p/742b4b248da9 序言 在iOS开发中,苹果提供了许多机制给我们进行回调.KVO(key-value-observing)是一种十分有趣 ...
- MVC异常处理
处理局部异常 控制器: @Controller @RequestMapping("/ex") public class ExceptionController { @Excepti ...
- HTML语言和CSS开发商业站点 错题
1.关于css为什么会出现Bug说法不正确的是(). (选项两项) A.编写CSS样式是需要在不同浏览器中实现表现一致 B.各大主流浏览器由于不同厂家开发,浏览器使用的内核不同,支持CSS的程度不同 ...
- (全国多校重现赛一)D Dying light
LsF is visiting a local amusement park with his friends, and a mirror room successfully attracts his ...
- CodeForces1006D-Two Strings Swaps
D. Two Strings Swaps time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- 2018NOIP赛后总结+后阶段信奥学习个人规划
目录 2018NOIP赛后总结 赛前 赛时 赛后 后阶段信奥学习个人规划 主要方针 学习安排 比赛安排 刷题安排 2018NOIP赛后总结 赛前 在无数次的思想挣扎后,我在倒数 3 天的时候请假了.这 ...
- 【HTTP】402- 深入理解http2.0协议,看这篇就够了!
本文字数:3825字 预计阅读时间:20分钟 导读 http2.0是一种安全高效的下一代http传输协议.安全是因为http2.0建立在https协议的基础上,高效是因为它是通过二进制分帧来进行数据传 ...
- 松软科技Web课堂:JavaScript this 关键词
实例 var person = { firstName: "Bill", lastName : "Gates", id : 678, fullName : fu ...