GRASS Programmer's Manual  6.4.2(2012)
malloc.c
Go to the documentation of this file.
00001 /*
00002  **  Written by David Gerdes  US Army Construction Engineering Research Lab
00003  **     April 1992
00004  **  Copyright 1992 USA-CERL   All rights reserved.
00005  **
00006  */
00007 
00008 /*
00009  **  takes 1st command line argument and stuffs each letter of it into
00010  **   a linked list.  then prints it back out to stdout.
00011  **  If a second argument is specified, the first argument is put in the
00012  **   list backwards.
00013  */
00014 #include <stdio.h>
00015 #include <grass/linkm.h>
00016 
00017 struct link
00018 {
00019     char let;
00020     struct link *next;
00021 };
00022 
00023 int main(int argc, char *argv[])
00024 {
00025     register int i;
00026     VOID_T *head;
00027     struct link List, *tmp, *p;
00028     int rev = 0;
00029 
00030 
00031     for (i = 0; i < 2000000; i++) {
00032         p = (struct link *)malloc(sizeof(struct link));
00033         free(p);
00034     }
00035 
00036 
00037     exit(0);
00038 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines