a quick question. I'm trying to write a function which recieves a name of a string and prints its second character, But it won't compile (on http://ideone.com), can you address the issue? I don't see the problem as I am sending an address into the function, and asking to access the character in that address.
#include <stdio.h>
int main(void) {
char line[4] = "abc";
test(line);
return 0;
}
void test(int point) {
point++;
printf("%c",*point);
return;
}
The compile error that I am getting is -
Compilation error time: 0 memory: 10320 signal:0
prog.c: In function ‘main’:
prog.c:5:2: warning: implicit declaration of function ‘test’ [-Wimplicit-function-declaration]
test(line);
^~~~
prog.c: At top level:
prog.c:9:6: warning: conflicting types for ‘test’
void test(int point) {
^~~~
prog.c:5:2: note: previous implicit declaration of ‘test’ was here
test(line);
^~~~
prog.c: In function ‘test’:
prog.c:11:14: error: invalid type argument of unary ‘*’ (have ‘int’)
printf("%c",*point);
^~~~~~
intinstead ofchar*? Alsointcan not be dereferenced.test(char* point)