Techhgeekz ™

Tuesday 3 September 2013

finding the string position using strcspn

finding string position using "strcspn":-

#include <stdio.h>
#include <string.h>
int main ()
{
  char str[] = "fcba73";
  char keys[] = "f";
  int i;
  i = strcspn (str,keys);
  printf ("The first number in str is at position %d.\n",i+1);
  return 0;
}

No comments:

Post a Comment