查找地址: &运算符

作者:追风剑情 发布于:2019-9-26 20:56 分类:C

示例:

//Visual Studio中加上这句才可以使用scanf()
//否则只能使用scanf_s()
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>

void mikado(int);

//argc: 参数个数 argv[]: 参数数组
int main(int argc, char *argv[])
{
	int pooh = 2, bah = 5;
	printf("In main(), pooh = %d and &pooh = %p\n", pooh, &pooh);
	printf("In main(), bah = %d and &bah = %p\n", bah, &bah);
	mikado(pooh);

	system("pause");
	return 0;
}

void mikado(int bah)
{
	int pooh = 10;
	printf("In mikado(), pooh = %d and &pooh = %p\n", pooh, &pooh);
	printf("In mikado(), bah = %d and &bah = %p\n", bah, &bah);
}

运行测试

11111.png

标签: C语言

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号