return to first page linux journal archive
keywordscontents

Listing 2. Pre-Read (prer.c)

#include <stdio.h>
#include <string.h>
/* Example of Pre-Read */
int main(void) 
{
   char *foo;
   foo = (char *) malloc(10);
   strcpy(foo,"hello");
   foo--;
   /* printf access before allocated area */
   printf("%s\n",foo);
   free(foo);
   return(0);
}