U E D R , A S I H C RSS

새싹교실/2020/새싹부터나무까지/김예찬/실습/20.10.02

1-1

int main() {
		int number[10] = { 1,3,5,7,9,11,13,15,17,19 };
		int i, * p;


		for (i = 0; i < 10; i++) {
			printf("%d\n", *(number + i));
		}
	return 0;
}

1-2


int main() {
		int number[10] = { 1,3,5,7,9,11,13,15,17,19 };
		int i, * p;

		p = number;

		for (i = 0; i < 10; i++) {
			printf("%d\n", p[i]);
		}
	return 0;
}

1-3


int main() {
		int number[10] = { 1,3,5,7,9,11,13,15,17,19 };
		int i;
		int *p = &number[0];

		for (i = 0; i < 10; i++) {
			printf("%d\n", *p++);
		}
	return 0;
}


2-1

int main() {
	int number[3][4] = { {1,3,5,7},{9,11,13,15},{17,19,21,23} };
	int i, j,*p;
	
		for (i = 0; i < 3; i++) {
			for (j = 0; j < 4; j++) {
				printf("%d\n", number[i][j]);
			}
		}
	return 0;
}

2-2

int main() {
	int number[3][4] = { {1,3,5,7},{9,11,13,15},{17,19,21,23} };
	int i, j,*p=&number[0][0];
	
		for (i = 0; i < 3; i++) {
			for (j = 0; j < 4; j++) {
				printf("%d\n", *p++);
			}
		}
	return 0;
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-16 14:07:53
Processing time 0.0088 sec