Compare commits
No commits in common. "32e70e96cefee81b4261451c340239f8f7ddfc1d" and "1a894440f9727d9c9f8d3c9ea5f2bd22c35b8038" have entirely different histories.
32e70e96ce
...
1a894440f9
1
lcthw/.gitignore
vendored
1
lcthw/.gitignore
vendored
@ -5,4 +5,3 @@ ex8
|
|||||||
ex9
|
ex9
|
||||||
ex10
|
ex10
|
||||||
ex11
|
ex11
|
||||||
ex12
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CFLAGS ?= -Wall -g
|
CFLAGS ?= -Wall -g
|
||||||
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
||||||
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9 ex10 ex11 ex12
|
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9 ex10 ex11
|
||||||
TEST_TARGETS = ex1 ex3 ex7 ex8 ex9 ex11 ex12
|
TEST_TARGETS = ex1 ex3 ex7 ex8 ex9 ex11
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build test
|
all: build test
|
||||||
|
32
lcthw/ex12.c
32
lcthw/ex12.c
@ -1,32 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int areas[] = { 10, 12, 13, 14, 20 };
|
|
||||||
char name[] = "Zed";
|
|
||||||
char full_name[] = {
|
|
||||||
'Z', 'e', 'd',
|
|
||||||
' ', 'A', '.', ' ',
|
|
||||||
'S', 'h', 'a', 'w',
|
|
||||||
};
|
|
||||||
|
|
||||||
// WARNING: On some systems you may have to change the
|
|
||||||
// %ld in this code to a %u since it will use unsigned ints
|
|
||||||
printf("The size of an int: %ld\n", sizeof(int));
|
|
||||||
printf("The size of areas (int[]): %ld\n", sizeof(areas));
|
|
||||||
printf("The number of ints in areas: %ld\n",
|
|
||||||
sizeof(areas) / sizeof(int));
|
|
||||||
printf("The first area is %d, the 2nd %d.\n", areas[0], areas[1]);
|
|
||||||
|
|
||||||
printf("The size of a char: %ld\n", sizeof(char));
|
|
||||||
printf("The size of name (char[]): %ld\n", sizeof(name));
|
|
||||||
printf("The number of chars: %ld\n", sizeof(name) / sizeof(char));
|
|
||||||
|
|
||||||
printf("The size of full_name (char[]): %ld\n", sizeof(full_name));
|
|
||||||
printf("The number of chars: %ld\n",
|
|
||||||
sizeof(full_name) / sizeof(char));
|
|
||||||
|
|
||||||
printf("name=\"%s\" and full_name=\"%s\"\n", name, full_name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user