#include<stdio.h>
#include<stdlib.h>
typedef struct{
int number;
int value;
int suit;
} CardT;
CardT initCard(CardT, int);
int compareCard(CardT, CardT);
void displayCard(CardT);
int main(void){
CardT cardB;
printf("hey man\n");
initCard(cardB, 32);
printf("%i\n", &cardB.number);
printf("%i\n", &cardB.value);
printf("%i\n", &cardB.suit);
return(0);
}
CardT initCard(CardT Card, int x){
Card.number = x;
if (x%13 == 8){ Card.value = 'T';}
else if (x%13 == 9){ Card.value = 'J';}
else if (x%13 == 10){ Card.value = 'Q';}
else if (x%13 == 11){ Card.value = "K";}
else if (x%13 == 12){ Card.value = "A";}
else {Card.value = x%13;}
Card.suit = x/4;
return Card;
}
So things compile, but the output is the memory location of the number. I can't figure out how to output the actual number without an error. Any clues?
&in the printf, you are passing a pointer to the value you just want the value.%ito%cforcardB.value, assuming you want to see K instead of 75.