diff options
| author | Abigail <abigail@abigail.be> | 2021-04-12 14:06:46 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-04-12 14:06:46 +0200 |
| commit | f02c5746861535f4471879d33ff63759bbcd6e9a (patch) | |
| tree | 36d78deb67ee9dbc9d17a4630fe9c08035015d53 /challenge-108 | |
| parent | 1d687ed1911a31f57ca6714cc85b4eacf78dfbfe (diff) | |
| download | perlweeklychallenge-club-f02c5746861535f4471879d33ff63759bbcd6e9a.tar.gz perlweeklychallenge-club-f02c5746861535f4471879d33ff63759bbcd6e9a.tar.bz2 perlweeklychallenge-club-f02c5746861535f4471879d33ff63759bbcd6e9a.zip | |
C solution for week 108, part 1
Diffstat (limited to 'challenge-108')
| -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); +} |
