Determines whether a string begins with a specific character
#include <stdio.h> #include <stdlib.h> #include <string.h> bool StartsWith(const char *a, const char *b) { if(strncmp(a, b, strlen(b)) == 0) return 1; return 0; } int main(int argc, char const *argv[]) { if(StartsWith("hello lautturi", "hell")) { printf("string start with hell"); }else { printf("string does not start with hell"); } return 0; }