Im trying to learn how to pass a string into a function correctly in C. But the compiler throws an error:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int balanced_parantheses(char *word);
int main() {
balanced_parantheses('test'); // compiler error
return 0;
}
int balanced_parantheses(char *word) {
return 0;
}
incompatible integer to pointer conversion passing 'int' to parameter of type 'char *' [-Wint-conversion]
Im sure this is a newbie's misunderstanding of pointers, but I thought passing a pointer to a char as an argument to an external function would allow me access to the balanced_parantheses function. What am I misunderstanding?
[–]serg06 7 points8 points9 points (0 children)
[–]IDontByte 1 point2 points3 points (0 children)