Ad
  • Default User Avatar

    I dont know if it's too late and you've already solved it, but chars in c are marked by single quotation marks: ''. Having: "" means you're trying to compare strings, which you must use strcmp for. str[j] is a char so your comparison should be with a char.

  • Default User Avatar

    Please help me !!

    #include <stdbool.h>
    #include <stdio.h>
    #include <stdlib.h>

    bool xo (const char* str)
    {

    int count = 0;
    for (int i = 0; i < strlen(str); i++){
      if(str[i] == "x" || str[i] == "X"){
        count++;
      }
    }
    

    return count;

    int countY = 0;
      for (int j = 0; j < strlen(str); j++;){
      if(str[j] == "y" || str[j] == "Y" ){
        countY++;
        }
    }
    

    return countY;

    if (count == countY){
    return true;
    }
    else {return false;}
    }