GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
linkm.c
Go to the documentation of this file.
1
2
/*
3
** Written by David Gerdes US Army Construction Engineering Research Lab
4
** April 1992
5
** Copyright 1992 USA-CERL All rights reserved.
6
**
7
*/
8
9
/*
10
** takes 1st command line argument and stuffs each letter of it into
11
** a linked list. then prints it back out to stdout.
12
** If a second argument is specified, the first argument is put in the
13
** list backwards.
14
*/
15
#include <stdio.h>
16
#include <grass/linkm.h>
17
18
struct
link
19
{
20
char
let
;
21
struct
link
*
next
;
22
};
23
24
int
main
(
int
argc,
char
*argv[])
25
{
26
register
int
i;
27
VOID_T
*head;
28
struct
link
List, *tmp, *p;
29
int
rev = 0;
30
31
32
/*
33
List.next = NULL;
34
List.let = ' ';
35
*/
36
37
38
head = (
VOID_T
*)
link_init
(
sizeof
(
struct
link
));
39
40
41
for
(i = 0; i < 2000000; i++) {
42
/*
43
p = (struct link *) malloc (sizeof (struct link));
44
free (p);
45
*/
46
p = (
struct
link
*)
link_new
(head);
47
link_destroy
(head, p);
48
}
49
50
link_cleanup
(head);
51
52
exit(0);
53
}
lib
linkm
linkm.c
Generated on Sun Mar 16 2014 05:07:46 for GRASS Programmer's Manual by
1.8.1.2