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 ...
随机推荐
- KETTLE实现复杂的流程
KETTLE是一款将数据从来源端经过抽取(extract).转换(transform).加载(load)至目的端的非常好用的一款ETL工具.学会它,对于跨数据库的表处理或者定时生成文本,excel等常 ...
- Java 从入门到进阶之路(十二)
在之前的文章我们介绍了一下 Java 类的重写及与重载的区别,本章我们来看一下 Java 类的 private,static,final. 我们在之前引入 Java 类概念的时候是通过商场收银台来引入 ...
- springboot+mybatis sql 打印在控制台
第一种方法 在mybatis文件夹下新建mybatis-config.xml <?xml version="1.0" encoding="UTF-8" ? ...
- luogu P4462 [CQOI2018]异或序列 |莫队
题目描述 已知一个长度为n的整数数列a1,a2,...,an,给定查询参数l.r,问在al,al+1,...,ar区间内,有多少子序列满足异或和等于k.也就是说,对于所有的x,y (I ≤ x ≤ ...
- 洛谷 P2254 [NOI2005]瑰丽华尔兹(单调栈优化DP)
题目描述 不妨认为舞厅是一个N行M列的矩阵,矩阵中的某些方格上堆放了一些家具,其他的则是空地.钢琴可以在空地上滑动,但不能撞上家具或滑出舞厅,否则会损坏钢琴和家具,引来难缠的船长.每个时刻,钢琴都会随 ...
- A* 算法讲解
在看下面这篇文章之前,先介绍几个理论知识,有助于理解A*算法. 启发式搜索:启发式搜索就是在状态空间中的搜索对每一个搜索的位置进行评估,得到最好的位置,再从这个位置进行搜索直到目标.这样可以省略大量无 ...
- CodeForces1006E- Military Problem
E. Military Problem time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- 【Vuejs】335-(超全) Vue 项目性能优化实践指南
点击上方"前端自习课"关注,学习起来~ 前言 Vue 框架通过数据双向绑定和虚拟 DOM 技术,帮我们处理了前端开发中最脏最累的 DOM 操作部分, 我们不再需要去考虑如何操作 D ...
- 大数据学习笔记——Java篇之基础知识
Java / 计算机基础知识整理 在进行知识梳理同时也是个人的第一篇技术博客之前,首先祝贺一下,经历了一年左右的学习,从完完全全的计算机小白,现在终于可以做一些产出了!可以说也是颇为感慨,个人认为,学 ...
- 理解Vue中的nextTick
参考博客:https://www.jianshu.com/p/a7550c0e164f