gcc
In function ‘int main()’:
14: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
clang
14: error: no matching function for call to 'strcmp'
note: candidate function not viable: no known conversion from 'char' to 'const char *' for 1st argument;
you are dereferencing the array, obtaining one element, that is just one character.
And if you bother to read the warnings
8: warning: ISO C++ forbids variable length array ‘strnum’ [-Wvla]
13: warning: null argument where non-null required (argument 2) [-Wnonnull]
no idea what you think you are doing there.
> The function of this program is to print out the number of times that a space is in a given string.
Then do a loop and compare the characters
Line 13 won't work even if it compiles. strcmp requires two null-terminated strings. You're passing it NULL. Also line 14 is bad because you're passing strnum[index] which is a char, not a char*.
I suggest that you look into using strchr() instead. This will find the first occurence of a character in a string, which is what you want.