View Single Post
Old 08-09-2003, 01:21 PM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
now waitaminute,
is this intended as a demostration of the language, or of the api?
your function just calls another function. it doesn't really demonstrate that you are capable of finding the number of times a character appears in a string.
how about we see a reimplementation of instr() in vb instead of just calling it?

for my part, here it is in c:

Code:
int char_count(char *s, char c)
{
  int num = 0;

  for( ; *s != '\0'; s++)
  {
    if(*s == c) num++;
  }
  return num;
}
joe_bruin is offline   Reply With Quote