Want to XOR two strings fetched from argv. I checked this question How to xor two string in C? but it could not solve it for me.
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[]) {
char output[]="";
int i;
for (i=0; i<strlen(argv[1]); i++){
char temp = argv[1][i]^argv[2][i];
output[i]= temp;
}
output[i] = '\0';
printf("XOR: %s\n",output);
return 0;
}
When I use lldb to debug my output ("(lldb) print output") it is /a/x16/t/x13 but it can not be printed by printf(). I know that it is not a string anymore. Can you help me how to make it able to be printf:ed. The text that is printed in the terminal is "XOR: "