Question

Complete the C function to find the first occurrence of a character c in a string str and return its index. Return -1 if not found. #include // For strlen, though not strictly needed for this loop int find_char_index(const char* str, char
c) {     int i = 0;     while (str[i] != '\0') {         if (_________ ) { // Line to complete             return i;         }         i++;     }     return -1; }

A str[i] == c
B str[i] != c
C c == str[i]
D str[i] == '\0'
E i == c
Practice Next

Hey! Ask a query