I have a file, cr.c
.
void main(int argCount, char **args) {
system("/usr/bin/javac " + args[1]);
}
When I try to compile, it gives me an error:
cr.c: In function ‘main’:
cr.c:6:30: error: invalid operands to binary + (have ‘char *’ and ‘char *’)
system("/usr/bin/javac " + args[1]);
^
I have tried to fix it by replacing +
with .
, as I that is one way of joining strings in PHP. It was just a guess.
I do not know why this is happening. Please explain why this is happening, and how to fix it. I would not like for somebody else to judt show me what to type instead, as I want to learn.
Thanks!