can you please tell me what is wrong with the following input process?
the input should be a string length and then the string itself.
something like "5 vlady"
It works just fine, but valgrind (memory leakage tool) tell the following exception:
Address 0x51ef184 is 0 bytes after a block of size 4 alloc'd
Her's the code:
unsigned int n;
char* string;
printf("Enter your string:\n");
scanf("%d", &n);
string = (char*)calloc((n),sizeof(char));
scanf("%s", string);
Thanks!