diff options
| -rw-r--r-- | challenge-108/abigail/README.md | 1 | ||||
| -rw-r--r-- | challenge-108/abigail/c/ch-1.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-108/abigail/README.md b/challenge-108/abigail/README.md index ef7fb8b526..98a4523d47 100644 --- a/challenge-108/abigail/README.md +++ b/challenge-108/abigail/README.md @@ -5,6 +5,7 @@ Write a script to declare a variable or constant and print it's location in the memory. ### Solutions +* [C](c/ch-1.c) * [Perl](perl/ch-1.pl) ### Blog diff --git a/challenge-108/abigail/c/ch-1.c b/challenge-108/abigail/c/ch-1.c new file mode 100644 index 0000000000..0d1ad208bf --- /dev/null +++ b/challenge-108/abigail/c/ch-1.c @@ -0,0 +1,21 @@ +# include <stdlib.h> +# include <stdio.h> +# include <string.h> + +/* + * See ../README.md + */ + +/* + * Run as: cc -o ch-1.o ch-1.c; ./ch-1.o + */ + +int main (void) { + int i; + printf ("%lld\n", (long long) &i); /* %p is specific for printing */ + /* memory addresses, but does this */ + /* using hex numbers. So we cast */ + /* the address to long long and */ + /* print that. */ + return (0); +} |
