Still confused with pointers
I was trying to return the position of a character in a string. The code below doesn't work because of the int *c, if I remove the *, it works fine. Just out of curiosity, how would it be possible to make it work without removing the "*" ? Whitch method would usually be prefered ?
Code:
int find_chr_index(char char *aeg, int *c)
{
int p = strlen(aeg);
int i = 0;
for(i = 0; i < p; i++)
{
if((int)aeg[i] == c) return i;
}
return -1;
}
Also..how to compare and add a string and a char (given as char *a str and char c) ?
Best wishes and thanks, D5