⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 explore.c

📁 String Pointers to explore how the pointer work
💻 C
字号:
/* explore.c: program to explore memory locations via pointers   bob wilson   10/29/2004   */#include <stdio.h>int a = 0x11111111;static int b = 0x22222222;void foobar(int, int, int *, int *);int main(void){	static int c = 0x33333333;	int d = 0x44444444;	int *ap = &a;	int *bp = &b;	int *cp = &c;	int *dp = &d;	int array[1] = {0x55555555};/* add code here to print the address of array[0]  */	printf("address of array[0] = %08p\n", array);/* add code here to print the variables a, b, c, d and pointers  */	printf("a  = %08x, b  = %08x, c  = %08x, d  = %08x\n", a, b, c, d);	printf("ap = %08p, bp = %08p, cp = %08p, dp = %08p\n", ap, bp, cp, dp);/* add code here to print array[i] for i = 0 to high enough value *//* print out the array index, value of address, and the value */		int i;	for (i= 0; i < 6; i++)	   printf("%3d, %08p, %08x\n", i, &array[i], array[i]);/* call function foobar and pass arguments  */	foobar(a, d, &a, &d);	return;}void foobar(int x, int y, int *xp, int *yp){	int array[1] = {0x66666666};		printf("Entering foobar\n");/* add code here to print array[i] for i = 0 to high enough value *//* print out the array index, value of address, and the value */	printf("auto variable array = %p\n", array);	int i;	for (i = 0; i < 40; i++)	   printf("%3d, %08p, %08x\n", i, &array[i], array[i]);	return;}

⌨️ 快捷键说明

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