Is there any simple way to add a char array to another array in C?
Answers
Answered by
0
How can I add '.' to the char Array := "Hello World" in C, so I get a char Array: "Hello World." The Question seems simple but I'm struggling.
Tried the following:
char str[1024]; char tmp = '.'; strcat(str, tmp);
But it does not work. It shows me the error: "passing argument 2 of ‘strcat’ makes pointer from integer without a cast" I know that in C a char can be cast as int aswell. Do I have to convert the tmp to an char array aswell or is there a better solution?
c
i hope it help you, pls make me brainlist
Tried the following:
char str[1024]; char tmp = '.'; strcat(str, tmp);
But it does not work. It shows me the error: "passing argument 2 of ‘strcat’ makes pointer from integer without a cast" I know that in C a char can be cast as int aswell. Do I have to convert the tmp to an char array aswell or is there a better solution?
c
i hope it help you, pls make me brainlist
Similar questions