Turbo C Null Pointer Assignment
Technical Interview Questions Ja
Best Answer: The following remarks reference the code further down: The first part would set a condition, before performing a strcpy. Please note, that the variable a is initialized to NULL the second part could trigger the null pointer assignment error twice with a) strcpy(a, a); b) printf('Name: %s', a.
Null pointer assignment is a run-time error associated with ancient Turbo C++. As a matter of fact, along with the programmer who is haunted by null pointer assignment error, developer of TC is equally guilty in my opinion if we take into account the current computing environment.
These are all serious errors, symptoms of a wild pointer or subscript. Null pointer assignment is a message you might get when an MS-DOS program finishes executing. Some such programs can arrange for a small amount of memory to be available “where the NULL pointer points to (so to speak). If the program tries to write to that area, it will overwrite the data put there by the compiler. When the program is done, code generated by the compiler examines that area.
- Null pointer assignment. This is a discussion on Null pointer assignment within the C Programming forums, part of the General Programming Boards category; Hi I wrote a c program where my input is a file and i store output also in a file.
- 5. Null Pointers. 5.1 What is this infamous null pointer, anyway? 5.2 How do I get a null pointer in my programs? 5.3 Is the abbreviated pointer comparison ``if(p)'' to test for non-null pointers valid?
The void pointer, or void*, is supported in ANSI C and C++ as a generic pointer type. A pointer to void can store an address to any non-function data type, and, in C, is implicitly converted to any other pointer type on assignment, but it must be explicitly cast if dereferenced inline. K&R C used char* for the “type-agnostic pointer” purpose (before ANSI C).