pointfun.c

来自「C源码集」· C语言 代码 · 共 31 行

C
31
字号
#include <stdio.h>void change (int *p);//prototype says that change will not return a value and it expects//to be given a pointer to an integer, i.e. the address of an integerint main (){	int var = 5;	printf("Before change, var is %i \n", var);	change(&var);	//call the function change. Send it the address of var	printf("After change, var is %i\n", var);	return 0;}void change (int *p){	*p *= 100;	// what p points to becomes itself * 100	printf("In change, *p is %i\n", *p);	//change doesn't know anything about var	//but it does know the place p points to}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?