I want to store the filename path in a char
variable and pass it later via function call. To do so, I declared the following char buffer:
char *filename_path = malloc(100* sizeof(char));
Now, to test that, I assigned it using a path followed by printing the value of the buffer to make sure it fits well.
filename_path= "../Datasets/Cluster(%d)%s";
printf("%s\n", filename_path);
...
free(filename_path);
However, I get this error :
../Datasets/Cluster(%d)%s
k.out(1154,0x7fff9843c3c0) malloc: *** error for object 0x103fbbacb: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Can someone hint me where the issue could be? Thank you