התוכנה כותבת לי שגיאה על המילה
strndup
אולי מישהו יודע אם זה משתנה בגרסאות של וויזואל סטודיו ואיך אפשר לסדר זאת?

char tav = str[strlen(str)/2+1];
int a,b,anser;
char* as = strndup(str, strlen(str) / 2 - *str);
char* bs = strndup(str+ strlen(str) / 2 - *str+2, strlen(str) / 2 - *str);
a = atoi(as);
b = atoi(bs);
if (tav == '+')
    anser = a + b;
else if (tav == '-')
    anser == a - b;
else if (tav == '*')
    anser == a * b;
else if (tav == '/')
    anser == a / b;

puts(str);

Here we are primarily an English forum Google Translate offers me this:

The software writes me an error on the word
strndup
Maybe someone knows if this varies in versions of Visual Studio and how can this be arranged?

If I'm reading https://en.cppreference.com/w/c/experimental/dynamic/strndup correctly you are missing a few free() statements so the code as-is is broken.

It should be anser = instead of double equals the way you did for the plus sign, for the other operations, when making assignments.

commented: If the error was just on strndup(), could this incomplete code be missing the include statements too? +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.