strspn.c 320 B

12345678910111213
  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. return 0;
  11. }