Answers for "c if string contains char"

C
0

check if string contains a character in c

#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[] = "Hi, I'm odd!";
  int exclamationCheck = 0;
  if(strchr(str, '!') != NULL)
  {
    exclamationCheck = 1;
  }
  printf("exclamationCheck = %d\n", exclamationCheck);
  return 0;
}
Posted by: Guest on April-27-2022

Code answers related to "c if string contains char"

Code answers related to "C"

Browse Popular Code Answers by Language