#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define JEOPARDY 30
#define TRUE 1
#define FALSE 0
typedef char string30[JEOPARDY+1] ;
typedef char string15[16] ;
typedef char string5[6] ;
struct GamesTag
{
string30 strCategory[5], strQuestion[5][5], strAnswer[5][5], strValue[5][5], strFQues, strFAns; ;
string15 strGameName;
struct GamesTag *pLink;
};
typedef struct GamesTag *ptrGame;
void deleteCategory(ptrGame *pGames, string30 strCategoryToDelete)
{
int i = 0, j = 0;
ptrGame pPrevious, pCurrent ;
/* This function deletes the category that the user inputs. */
if(*pGames == NULL)
printf("List is Empty.\n") ;
else if(strcasecmp(strCategoryToDelete, (*pGames)->strCategory[j][i]) == 0)
{
pCurrent = *pGames ;
*pGames = (*pGames)->pLink ;
free(pCurrent) ;
}
else
{
pCurrent = *pGames ;
while(pCurrent != NULL && strcasecmp(strCategoryToDelete, pCurrent->strCategory) != 0)
{
pPrevious = pCurrent ;
pCurrent = pCurrent->pLink ;
}
if(pCurrent != NULL)
{
pPrevious->pLink = pCurrent->pLink ;
free(pCurrent);
}
else
printf("Category does not exist.\n\n") ;
}
while(i < 5)
{
for( j = 0 ; j < 31 ; j++)
{
pCurrent->strQuestion[i][j] = '\0';
pCurrent->strAnswer[i][j] = '\0';
pCurrent->strValue[i][j] = '\0';
}
strcpy(pCurrent->strQuestion[i], pCurrent->strQuestion[i+1]) ;
strcpy(pCurrent->strAnswer[i], pCurrent->strAnswer[i+1]) ;
strcpy(pCurrent->strValue[i], pCurrent->strValue[i+1]) ;
i++ ;
}
}
void search(ptrGame pGames)
{
int i, j;
ptrGame pRun = pGames;
string30 strWord;
if (pRun == NULL)
printf("Nothing to search.\n");
else
{
j = 0;
while(pRun!=NULL)
{
i = 0;
puts(pRun->strCategory[j][i]);
pRun = pRun->pLink;
i++;
j++;
}
pRun = pGames;
printf("Enter the category you want to search: \n");
scanf("%s",strWord);
if (pRun == NULL)
printf("Nothing to search.\n");
else
{
while(pRun != NULL)
{
if (strcmp(strWord, pRun->strCategory) == 0)
{
printf("Category: %s\n", pRun->strCategory);
for(i=0; i != 5; i++ )
{
printf("Question: %s\n", pRun->strQuestion[i]);
printf("Answer: %s \n", pRun->strAnswer[i]);
printf("Value: %s \n", pRun->strValue[i]);
}
}
pRun = pRun->pLink;
}
}
}
}
I keep on getting errors that passing argument are from different pointer types. What to do I do now?