while that fix might compile, it is wrong.
try
void checkpos(char cmd[3])
{
int count=0;
int move[5]; // why an array? this code never can parse more than one...
const char *tmp;
for(int i=0;i<3;++i)
if (cmd[i]==',')
{
tmp=&cmd[i+1];
move[count++]=atoi(tmp);
// and now? break? cmd can not contain further moves....
// what about the (skipped) 'x'?
}
}
void checkpos(char cmd[3])
{
int count=0;
int move[5]; // why an array? this code never can parse more than one...
const char *tmp;
for(int i=0;i<3;++i)
if (cmd[i]==',')
{
tmp=&cmd[i+1];
move[count++]=atoi(tmp);
// and now? break? cmd can not contain further moves....
// what about the (skipped) 'x'?
}
}
To copy to clipboard, switch view to plain text mode
Note that char cmd[3] is quite a limitation and prevents you from parsing stuff like "15,x"
Bookmarks