strspn.c 305 B

1234567891011
  1. #include <string.h>
  2. #include <stdio.h>
  3. int main(void) {
  4. char *hello = "hello";
  5. char *world = "world";
  6. char *banana = "banana";
  7. printf("%lu\n", strspn(hello, "hello")); // should be 5
  8. printf("%lu\n", strspn(world, "wendy")); // should be 1
  9. printf("%lu\n", strspn(banana, "apple")); // should be 0
  10. }