Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • In the printf "before malloc valu", you are dereferencing a NULL pointer. Don't do that. Commented Aug 10, 2011 at 7:20
  • after declaration of any pointer doesnt points to NULL...THEN ITS SAFE.. DOESNT IT..?? Commented Aug 10, 2011 at 7:23
  • 1
    No, its not always safe because that isn't standardized, and plus, you're not supposed to deference it when its NULL either. It leads to seg faults on any decent system. And, please refrain from using caps lock in the future. Commented Aug 10, 2011 at 7:24
  • 1
    @Dhaivat I don't see anywhere in this code that sets the pointer to NULL. Commented Aug 10, 2011 at 7:31
  • 1
    That's what I'm saying, that's its not standardized the pointer should be NULL, and, even if it isn't, he shouldn't be dereferencing something that doesn't have a set location to point to. Commented Aug 10, 2011 at 7:57