On 2022/01/14 13:45, Bilal Emohmadian wrote: > Because in GNU/Linux... char* line is NULL when i initialized it. You can > close topic.
It is not guaranteed that an automatic variable is set to any particular value on any OS. Maybe it _usually_ does on the Linux version you tested on with the compiler flags you used (you may well find that things change if you use different -O levels), but you can't guarantee it there, and certainly can't guarantee it on other OS/compilers. See e.g. https://stackoverflow.com/questions/1597405/what-happens-to-a-declared-uninitialized-variable-in-c-does-it-have-a-value https://stackoverflow.com/questions/54060312/automatic-initialization-of-local-variables-in-c > My solution is char* line = NULL. ^^ correct.