Can any one say, In which case Null Pointer Assignment is displayed on the output screen in a C programming ?Hoping ur answers .............Urs Raju

Dani AI

Generated

: the text "Null Pointer Assignment" is not a standard C runtime message. was right to suggest searching, because that phrase usually comes from a tool, a custom debug message, or a beginner description — not from the C language itself. Two distinct things are often conflated: assigning the null pointer value to a pointer (safe and allowed) versus dereferencing a null pointer (undefined behavior, usually a crash).

In C you can write p = NULL; to make p a null pointer. That assignment by itself is fine. Dereferencing a null pointer (for example *p = … when p is NULL) is undefined behavior and commonly causes a segmentation fault. See the C language rules on null pointer constants for details: . For general background on null pointers and runtime effects, see Null pointer — Wikipedia.

Quick troubleshooting checklist:

  • Initialize pointers to NULL and check them before dereferencing.
  • Always check results of allocation functions (like malloc) for NULL.
  • Turn on compiler warnings (e.g., -Wall -Wextra) and use sanitizers or tools such as AddressSanitizer to catch null dereferences at runtime.
  • If a third-party tool prints "Null Pointer Assignment", consult that tool's docs — it may be flagging an assignment into memory at address zero or a suspicious write involving a null pointer.

Recommended Answers

All 2 Replies

Thanx Mr.Grunt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.