So, I'm trying to do the following with some C code:
int eval_setence(char *words){
...
}
void main(){
char *words[8];
eval_setence(words);
}
But I'm don't know why the code is not compiling, I assume the function is getting a double pointer to words[8]
. Could someone explain what's going on?
I'm trying to do operations with the words[8]
inside the function, i.e:
if(words[i] == 'Wow')
...
char **
as your function argument. Also note that you can't compare strings with==
, and strings must be double-quoted, not single-quoted.strlen(words[0])
,strlen(words[1])
etc.int main(void)
orint main(int argc, char *argv[])
, or equivalent. Other implementation-defined forms are permitted, but there is really no good reason to usevoid main()
. The very same standard that introduced thevoid
keyword also specifiedint
as the return type formain
. See questions 11.12a and following in the comp.lang.c FAQ.