I can't seem to pass a struct address to a function. My program "stops working" when it gets to the scanf statement of the getReady function.
/****************************************************
Author:
----------------------------------------------------------------------
Purpose: This code will explore passing a data structure
address to a function.
****************************************************/
#include <stdio>
#include <stdlib>
//prototypes:
struct things{
char knife;
char pen;
char wallet;
char keys;
};
int getReady(struct things *t,char x);
void main()
{
char ready;
char r;
struct things *t;
ready =getReady(t,r);
if (ready == 'y')
printf("\nLet's go!!!");
}
int getReady(struct things *t,char x)
{
printf("\nHave you got your wallet? y/n: ");
scanf("%c",t->wallet);
printf("\nHave you got your pen? y/n: ");
scanf("%c",t->pen);
if((t->knife == 'n') || (t->pen == 'n')){
printf("\nYou're not ready...");
x = 'n';
}
else
x = 'y';
return x;
}