You're trying to use K&R style function declarators it seems, and that's a bad thing. Match your definitions and declarations, and you also need to declare functions that use a typedef after the typedef, or it won't be recognized. There are also a few other minor problems, and the formatting needs work. The following compiles, though I haven't tested it:
Code:
#include <stdlib.h>
#include <stdio.h>
#define LISTSIZE 6
#define TRUE 1
#define FALSE 0
typedef struct ListNode * ListNodePtr;
typedef struct ListNode
{
int data;
ListNodePtr next;
}ListNode;
int ListInsert(ListNodePtr * head, int data);
ListNodePtr ListReverse(ListNodePtr head);
void ListFree(ListNodePtr head);
void ListFree(ListNodePtr head);
void printSquared(int data);
void ListTraverse(ListNodePtr head, void (*process)(int));
int main (void)
{
int data;
int i;
ListNodePtr head = NULL;
for(i=0; i<LISTSIZE; i++)
{
data = rand();
if(!ListInsert(&head, data))
{
printf("Insertion of node falied\n");
ListFree(head);
return EXIT_FAILURE;
}
}
head = ListReverse(head);
ListTraverse(head, printSquared);
ListFree(head);
return 0;
}
int ListInsert(ListNodePtr * head, int data)
{
ListNodePtr newNode;
newNode = malloc(sizeof(ListNode));
if(!newNode)
{
printf("Cannnot allocate memory\n");
return FALSE;
}
newNode->data = data;
newNode->next = *head;
*head = newNode;
return 0;
}
ListNodePtr ListReverse(ListNodePtr head)
{
ListNodePtr next, current, previous;
current = NULL;
previous = NULL;
next = NULL;
while(current !=NULL)
{
next = current -> next;
current-> next = previous;
previous = current;
current = next;
}
return previous;
}
void ListFree(ListNodePtr head)
{
ListNodePtr current, next;
current = head;
next = NULL;
while(current != NULL)
{
next = current->next;
free(current);
current = next;
}
}
void printSquared(int data)
{
printf("%d\n",(data * data));
}
void ListTraverse(ListNodePtr head, void (*process)(int))
{
ListNodePtr current;
current = head;
while(current)
{
process(current->data);
current = current->next;
}
}
Also, it's generally a poor practice to hide levels of indirection behind a typedef. It confuses people.