author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sat, 13 Dec 2008 17:58:00 +0100 | |
changeset 8 | 96d16dfe787a |
parent 0 | af501b0c1716 |
child 9 | c3fecc82ade6 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* $Id: nomalloc.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $ |
|
3 |
* $Source: /development/c/demos/nomalloc.c,v $ |
|
4 |
* |
|
5 |
*/ |
|
6 |
||
7 |
#include <stdio.h> |
|
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
8 |
#include <stdlib.h> |
0 | 9 |
|
10 |
struct Names { |
|
11 |
char *name; |
|
12 |
int age; |
|
13 |
}; |
|
14 |
||
15 |
void setStruct (struct Names *names) |
|
16 |
{ |
|
17 |
names->name = "mbroeker"; |
|
18 |
names->age = 32; |
|
19 |
} |
|
20 |
||
21 |
void printStruct (struct Names *names) |
|
22 |
{ |
|
23 |
printf ("Name: %s\n", names->name); |
|
24 |
printf (" Age: %d\n", (*names).age); |
|
25 |
} |
|
26 |
||
27 |
int main (int argc, char **argv) |
|
28 |
{ |
|
29 |
struct Names names; |
|
30 |
||
31 |
setStruct (&names); |
|
32 |
printStruct (&names); |
|
33 |
||
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
34 |
return EXIT_SUCCESS; |
0 | 35 |
} |