author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Fri, 27 Dec 2013 16:00:09 +0100 | |
changeset 167 | 7c6b221900bf |
parent 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
1 |
/** |
77 | 2 |
* concatenation.c |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
0 | 4 |
*/ |
5 |
||
6 |
#include <stdio.h> |
|
7 |
#include <stdlib.h> |
|
8 |
#include <string.h> |
|
9 |
||
10 |
struct P { |
|
11 |
char *lastname; |
|
12 |
char *firstname; |
|
13 |
char *street; |
|
14 |
int postal; |
|
15 |
char *location; |
|
16 |
}; |
|
17 |
||
18 |
typedef struct P Person; |
|
19 |
||
20 |
#define insert(a) { person->a = a; } |
|
21 |
#define show(a) { printf("%9s:\t%s\n", #a, person.a); } |
|
22 |
#define show_int(a) { printf("%9s:\t%d\n", #a, person.a); } |
|
23 |
||
24 |
void print_Person (Person person) |
|
25 |
{ |
|
26 |
show (lastname); |
|
27 |
show (firstname); |
|
28 |
show (street); |
|
29 |
show_int (postal); |
|
30 |
show (location); |
|
31 |
printf ("\n"); |
|
32 |
} |
|
33 |
||
34 |
void set_Person (Person * person, char *lastname, char *firstname, char *street, int postal, char *location) |
|
35 |
{ |
|
36 |
/* |
|
37 |
* inserts <name> into person-><name> |
|
38 |
*/ |
|
39 |
insert (lastname); |
|
40 |
insert (firstname); |
|
41 |
insert (street); |
|
42 |
insert (postal); |
|
43 |
insert (location); |
|
44 |
} |
|
45 |
||
46 |
int main (int argc, char **argv) |
|
47 |
{ |
|
48 |
Person person[5]; |
|
27
81a574d60c15
typo in min2time format string
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
9
diff
changeset
|
49 |
|
0 | 50 |
int i; |
51 |
||
52 |
set_Person (&person[0], "Breitkopf", "Manuela", "Maxim-Gorki-Strasse 49", 18106, "Rostock"); |
|
53 |
set_Person (&person[1], "Bröker", "Markus", "Maxim-Gorki-Strasse 25", 18106, "Rostock"); |
|
54 |
set_Person (&person[2], "Fischer", "Tina", "Ehm-Welk Straße 11", 18106, "Rostock"); |
|
55 |
set_Person (&person[3], "Jopp", "Marika", "Bleicherstraße 12", 18155, "Rostock"); |
|
56 |
set_Person (&person[4], "Rennert", "Nicole", "Willi-Bredel-Strasse 20", 18106, "Rostock"); |
|
57 |
||
58 |
for (i = 0; i < 5; i++) { |
|
59 |
print_Person (person[i]); |
|
60 |
} |
|
61 |
||
62 |
return EXIT_SUCCESS; |
|
63 |
} |