I'm trying to pass a char array to a function in C.
My code is as follows
void Process(const char expect[])
{
char c0 = expect[0];
char c1 = expect[1];
}
Process("OK");
My debugger is telling me however that expect is a pointer to a single character, which doesn't make any sense to me. If I try to read the data from expect (what the c0 and c1 variables are doing), I get this (or something to this effect)
c0 = "O";
c1 = NULL;
What confuses me further is that I've done a similar function using the same syntax for arguments that works without any issues. Any help would be appreciated - thanks in advance.
#include <stdio.h>, andprintf("c0 = %c; c1 = %c\n", c0, c1);toProcess(), andint main(void) {before the call toProcess("OK");andreturn 0; }after it. Then debug that!