I created a program which prints out the alphabet in reverse order i.e. z y x w etc..
I'm trying to call a function which prints out the list however, I'm not sure what argument to pass into the function
code is below
Code:
/*Linked list to display the letters of the alphabet in REVERSE order*/
#include <stdio.h>
#include <stdlib.h>
typedef char DATA;
/*Create the node*/
struct node{
DATA d;
struct node *next;
};
/*pointers to node. Declared so that memory may be allocated*/
struct node *first_item;
struct node *current_item;
int main()
{
int n;
first_item = NULL;
for (n='a';n<='z';n++)
{
current_item = (struct node *)malloc(sizeof(struct node));
current_item->d = n;
current_item->next = first_item;
first_item=current_item;
}
showlist(??);
getchar();
return(0);
}
void showlist(??);
{
current_item=first_item;
while(current_item!=NULL)
{
printf("%c ", current_item->d);
current_item=current_item->next;
}
}