Create a memory diagram for the following C program for the second time the program reaches point one.
int foo(const char *x, int y);
int main(void)
{
int a, b;
a=foo("abcde", 'p');
b=foo("purple", 't');
return 0;
}
int foo(const char *x, int y)
{
int c = -1, i = 0;
while (x[i] != '\0')
{
if (x[i] == y)
i++;
}
//point 1
return c;
}
Get Answers For Free
Most questions answered within 1 hours.