strspn.c 332 B

12345678910111213
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include "test_helpers.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. }