"c" compiler error message...

why is the compiler giving me an error of undefined reference to
'findChar' ?? also how can I display the character entered. Any ideas would be appreciated. Thanks.

#include
#include


#define SIZE 100

int findChar(char array[], char c);
int findCount(char array[], int c);

int main()
{
int count;
int position;
int frequency;
char ch, array[SIZE];

printf("Enter a character :
");

for(count = 0; ((array[count] = getchar()) != '
'); ++count);
array[count+1] = '';

printf("Search a character :
");

ch = getchar();
position = findchar(array, ch);
frequency = findCount(array, ch);

if(position == -1)
{
printf("Not found!
");
}
else
{
printf("%c is found in the position of %d", ch, position+1);
printf("The count of %c is %d
", ch, frequency);
}
system("pause");
return 0;
}

int findChar(char array[], char c)
{
int i, j;
for(i = 0; array[i] != ''; i++)
{
if(array[i] == c)
{
return i;
}
}
return -1;
}

int findCount(char array[], int c)
{
int i;
int j = 0;

for(i = 0; array[i] != ''; i++)
{
if(array[i] == c)
{
j++;
}
}
return j;
}

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories