I am a begginer at C and I want to understand how to pass a char array to a method. And in the method access the array's values.
I tried making an example but i keep getting errors :/
here's my example:
int checkCommandSyntax(char * text);
int main(int vcount, char* varr)
char * text = "fg something";
int checkCommandSyntax(char * text)
int i = 0;
while (!(text[i] == '\0'))
Your code works fine besides one simple error. You are passing printf the argument %s which means it should print a string. You are trying to print one character, so change
%c denotes that you want to print a character value.