I am doing some work with something, and I am trying to
get into using char arrays. however i am kind of just
winging it, and could use some help with how to do certain
things, as i keep getting warnings from my compiler.
the variable:
char **ranks[5];
any help in getting rid of these, what to change etc?
thanks
<edit>
on a side note, i am getting very wierd memory leaks, the names are not being read in properly, i am guessing it has to do with the warnings.
get into using char arrays. however i am kind of just
winging it, and could use some help with how to do certain
things, as i keep getting warnings from my compiler.
the variable:
char **ranks[5];
usage:
fprintf( fp, "Ranks '%s' '%s' '%s' '%s' '%s'\n",
clan->ranks[0], clan->ranks[1],
clan->ranks[2], clan->ranks[3], clan->ranks[4] );
error from compiler:
clans.c:229: warning: char format, pointer arg (arg 3)
clans.c:229: warning: char format, pointer arg (arg 4)
clans.c:229: warning: char format, pointer arg (arg 5)
clans.c:229: warning: char format, pointer arg (arg 6)
clans.c:229: warning: char format, pointer arg (arg 7)
usage:
for ( i = 0; i < 5; i++ )
{
if (!clan->ranks)
clan->ranks = STRALLOC( "" );
}
error from compiler:
clans.c:472: warning: assignment from incompatible pointer type
usage:
ch_printf( ch, "\n\r&zMembers and Ranks:\n\r&W 1.) %s (%s)\n\r 2.) %s (%s)\n\r 3.) %s (%s)\n\r 4.) %s (%s)\n\r 5.) %s (%s)\n\r",
clan->positions[0][0] != '\0' ? clan->positions[0] : "Open", clan->ranks[0][0] != '\0' ? clan->ranks[0] : "",
clan->positions[1][0] != '\0' ? clan->positions[1] : "Open", clan->ranks[1][0] != '\0' ? clan->ranks[1] : "",
clan->positions[2][0] != '\0' ? clan->positions[2] : "Open", clan->ranks[2][0] != '\0' ? clan->ranks[2] : "",
clan->positions[3][0] != '\0' ? clan->positions[3] : "Open", clan->ranks[3][0] != '\0' ? clan->ranks[3] : "",
clan->positions[4][0] != '\0' ? clan->positions[4] : "Open", clan->ranks[4][0] != '\0' ? clan->ranks[4] : "" );
error from compiler:
clans.c:2681: warning: pointer type mismatch in conditional expression
any help in getting rid of these, what to change etc?
thanks
<edit>
on a side note, i am getting very wierd memory leaks, the names are not being read in properly, i am guessing it has to do with the warnings.