on-internet
← Community

In C, what exactly happens when you pass a NULL pointer to strcmp()?

Stack Overflow ·

I have read that the following results in undefined behavior. strcmp(foo, NULL); But what exactly happens "underneath the hood," so to speak? Is foo compared to garbage data? Is NULL dereferenced? What are the details that cause "undefined behavior"?

Comments

Sign in or sign up to comment and upvote.

No comments yet.