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 ...
随机推荐
- luogu P2759 奇怪的函数 |二分答案
题目描述 使得 x^x达到或超过 n 位数字的最小正整数 x 是多少? 输入格式 一个正整数 n 输出格式 使得 x^x达到 n 位数字的最小正整数 x 计算一个数有多少位 log10(x)+1 #i ...
- luogu P1801 【黑匣子_NOI导刊2010提高(06)】
这里提供一个简单实现新思路: . 约定: 以下n指代的数的数量,不是题目所指的n 以下m指代询问的数量,不是题目所指的m (不好意思,这是本人习惯) 分块+堆 **堆一次只能输出堆顶的一个元素,如果我 ...
- Cookie俩步操作实现n天免登陆
实现这个功能主要思路是:在登录成功的时候去给用户名和密码加上Cookie,将他们的值存在Cookie中,为了下次登录记住用户名和密码,然后在登录界面,获取所有的cookie,然后将值一一遍历出来.和用 ...
- Python字符串学习
Python字符串(不可变的): 一.相关的运算: 1.字符串的拼接: str = str1 + str2 2.字符串的重复: print(str * 3) 3.下标访问字符串某个字符: str[1] ...
- 小程序使用wxs解决wxml保留2位小数问题
1.出现溢出表现 从图中可以看到数字超出了很长长度.代码里面是如下这样的.为什么在0.35出现?或者一些相成的计算出现? 而 0.34却不会.(wap.0834jl.com) 0.41 也会出现,好像 ...
- [TimLinux] CSS pre超长自动换行
使用css样式值: pre { white-space: pre-wrap; word-wrap: break-word; }
- ACM小组的古怪象棋
Description ACM小组的Samsara和Staginner对中国象棋特别感兴趣,尤其对马(可能是因为这个棋子的走法比较多吧)的使用进行深入研究.今天他们又在 构思一个古怪的棋局:假如Sam ...
- (全国多校重现赛一)E-FFF at Valentine
At Valentine's eve, Shylock and Lucar were enjoying their time as any other couples. Suddenly, LSH, ...
- 怎么定义一个自己的vue组件
1.在src文件夹中创建一个hello文件夹,然后创建hello.js和hello.vue 2.hello.vue代码如下 <template> <button>这是hello ...
- 源码分析 RocketMQ DLedger(多副本) 之日志复制(传播)
目录 1.DLedgerEntryPusher 1.1 核心类图 1.2 构造方法 1.3 startup 2.EntryDispatcher 详解 2.1 核心类图 2.2 Push 请求类型 2. ...