예제 #1
0
파일: ex15.c 프로젝트: rzurad/lcthw
int main(int argc, char *argv[]) {
    // create two arrays we care about
    int ages[] = {23, 43, 12, 89, 2};
    char *names[] = {"Alan", "Frank", "Mary", "John", "Lisa"};
    int count = sizeof(ages) / sizeof(int);

    print_indexing(names, ages, count);
    print_divider();
    print_pointers(names, ages, count);
    print_divider();
    print_pointers_as_arrays(names, ages, count);
    print_divider();
    print_stupid_complex(names, ages, count);
    print_divider();
    print_addresses(names, ages, count);

    return 0;
}
예제 #2
0
파일: ex15.c 프로젝트: wolverian/lcthw
int main(int argc, char *argv[]) {
	// create two arrays we care about
	int ages[] = {23, 43, 12, 89, 2};
	char *names[] = {
		"Alan", "Frank",
		"Mary", "John", "Lisa"
	};
	int count = 5;

	print_indexing("%s has %d years alive.\n", count, names, ages);
	printf("---\n");

	print_pointing("%s has %d years alive.\n", count, names, ages);
	printf("---\n");

	print_pointing_again("%s is %d years old again.\n", count, names, ages);
	printf("---\n");

	print_stupid_complex_way("%s is %d years old again.\n", count, names, ages);
	printf("---\n");

	return 0;
}