strspn.c 351 B

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