Generally what I have to do? I should always initialize ptr?
char *ptr;
ptr = malloc (10);
OR
char *ptr = NULL ;
ptr = malloc (10);
And in a function?
void func(char **ptr)
{
    *ptr = malloc(10);
}
int main()
{
    char *ptr; /* OR char *ptr = NULL; ? */
    func(&ptr);
    return 0;
}
 
    