so im trying to make a program where i have characters, and i can battle them, ive simplified it as much as possible to try and just get the most basic pieces working (eventually itll read characters from a character.file and the characters character.items lol )
anyway i wrote this, and it wont compile, (syntax error here?: i=battle(struct monster bob, struct monster tony); ) so i tried deleting that function and writing a simple function just to see if i am not using the right function syntax, that worked fine, so i dunno what im doing wrong maybe i dont know how to use structures lol (i purposely dont have any pointers atm because i dont want to add bugs before i fix this)
Code:
#include <stdio.h>
#include <stdlib.h>
main()
{
int i=0;
struct monster
{
char name[30];
int type;
};
struct monster bob = {"bob\0", 1};
struct monster tony = {"tony\0", 2};
struct monster alex = {"alex\\", 3};
int battle(struct monster one, struct monster two)
{
if(one.type>two.type)
printf("%s wins",one.name);
else
printf("%s wins", two.name);
return(0);
}
i=battle(struct monster bob, struct monster tony);
printf("%d",i);
}