Help with some beginner C code!
A variable that is a string (or character array, such as shape) isn't really a string. Rather, the string resides in a place in memory, and the variable points to that place in memory. It is called a pointer because it points to that location. Since it's a pointer, and not an actual string, using == compares the pointers, and not the strings. If you didn't understand that, it's OK, but what you do need to understand is the fact that in order to see if 2 strings are equal, you need to use the function strcmp. In order to use it, you need to import string.h, and it returns 0 if the 2 strings are equal. As I mentioned earlier, you can use it in an if statement by either doing
if (!strcmp(shape, "circle"))
or
if (strcmp(shape, "circle") == 0)
(basically, the first one uses the !, so if what strcmp returns is 0, the if evaluates as true, otherwise false, and the second one does an equality check to see if strcmp returns 0)
if (!strcmp(shape, "circle"))
or
if (strcmp(shape, "circle") == 0)
(basically, the first one uses the !, so if what strcmp returns is 0, the if evaluates as true, otherwise false, and the second one does an equality check to see if strcmp returns 0)

