C

pointerAndArray

호타리 2023. 9. 1. 12:14
#include <stdio.h>



int main(void)

{

	int nums[] = {1, 2, 3, 4, 5};

	int *p;

	

	p = nums;     // p = &nums[0];

	printf("*p = %d\n", *p);

	

	++p;     // p = p + 1;

	printf("*p = %d\n", *p);

	

	p = nums;

	printf("*(p + 2) : %d\n", *(p + 2));

			

	return 0;

}

 

<compile 결과>