I'm using a string received from the arg to return another string with characters shuffled.
int size = strlen(argv[4]);
char* res = malloc(size+1);
Then res is filled with the characters of argv[4], but when I type 'test' in the console, it returns 'Test?' (when I'm not shuffling the letters but just copying the string, character by character).
Why is that ?
If I put size+100 instead, it works, but I don't get why.
Aucun commentaire:
Enregistrer un commentaire