The function getStringEnd() doesn't work correctly but I don't know why. The function does not return the correct value of the string end. I already found out that the variable max is not calculated right.
But
int max = sizeof str / sizeof (char);
should work, shouldn't it?
Do you have any ideas?
#include <stdio.h>
#define MAX_FIGURES 30  
int getStringEnd(const char * str);
int getStringEnd(const char * str)
{
    int max = sizeof str / sizeof (char);
    int counter = 0;
    while (counter <= max -1)
    {
        if ((str[counter] == '\0') || (str[counter] == '\n')) return counter;
        counter += 1;
    }
    return 0;
}
int main(void)
{
    char figures[MAX_FIGURES];
    for (int i = 0; i <= MAX_FIGURES - 1; i++) figures[i] = '\0';
    fgets(figures, MAX_FIGURES, stdin);
    int stringEnd = getStringEnd(&figures);
}
 
     
    