[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]


    Search the Q&A Archives


1. What does the error 'Null Pointer Assignment' mean and...

<< Back to: comp.lang.c Answers to Frequently Asked Questions (FAQ List)

Question by papai
Submitted on 9/11/2003
Related FAQ: comp.lang.c Answers to Frequently Asked Questions (FAQ List)
Rating: Rate this question: Vote
1.   What does the error 'Null Pointer Assignment' mean and what causes this error?
2.   What is near, far and huge pointers? How many bytes are occupied by them?
3.   How would you obtain segment and offset addresses from a far address of a memory location?
4.   what do the 'c' and 'v' in argc and argv stand for?
5.   Are the variables argc and argv are local to main?
6.   What is the maximum combined length of command line arguments including the space between adjacent arguments?
7.   If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
8.   Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
9.   What are bit fields? What is the use of bit fields in a Structure declaration?
10.   To which numbering system can the binary number 1101100100111100 be easily converted to?
11.   Which bit wise operator is suitable for checking whether a particular bit is on or off?
12.   Which bit wise operator is suitable for turning off a particular bit in a number?
13.   Which bit wise operator is suitable for putting on a particular bit in a number?
14.   Which bit wise operator is suitable for checking whether a particular bit is on or off?
15.   which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?
16.   Write a program which uses Command Line Arguments
17.   How can you increase the size of a dynamically allocated array?
18.   How can you increase the size of a statically allocated array?
19.   When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
20.   What is object file? How can you access object file?
21.   What do the functions atoi(), itoa() and gcvt() do?



Answer by naidu_trk
Submitted on 12/29/2003
Rating:  Rate this answer: Vote

A NULL pointer assignment is a runtime error
It occurs due to various reasons one is that ur program has tried to access an illegal memory location.
   Illegal location means either the location is in the operating systems address space or in the other processes memory space.
  In stdio.h NULL is defined as 0
  So whenever your program tries to access 0th location the operating system kills your program with runtime assignment error because  the 0th location is in the operating systems address space and operating system doesnt allow access to its address space  by user program .

 

Answer by oh come on
Submitted on 2/5/2004
Rating:  Rate this answer: Vote
1.   What does the error 'Null Pointer Assignment' mean and what causes this error?
: you are dereferencing a null pointer, probably
4.   what do the 'c' and 'v' in argc and argv stand for?
: count, and vector
5.   Are the variables argc and argv are local to main?
: as are all variables passed to a function
6.   What is the maximum combined length of command line arguments including the space between adjacent arguments?
: depends on how much memory you have, i think
7.   If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
: depends on your OS/shell, i think
8.   Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
: don't think so
9.   What are bit fields? What is the use of bit fields in a Structure declaration?
: look up unions. you can address data bit by bit, and so on.
10.   To which numbering system can the binary number 1101100100111100 be easily converted to?
: decimal???
11.   Which bit wise operator is suitable for checking whether a particular bit is on or off?
: OR. you may want to take a class in something so you know these things already.
12.   Which bit wise operator is suitable for turning off a particular bit in a number?
: AND
13.   Which bit wise operator is suitable for putting on a particular bit in a number?
: AND
14.   Which bit wise operator is suitable for checking whether a particular bit is on or off?
: you've just asked this Q11!
15.   which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?
: either. you can just use *2, the compiler will do the rest
16.   Write a program which uses Command Line Arguments
: int main(int argc, char **argv) {return atoi(argv[0]);}
17.   How can you increase the size of a dynamically allocated array?
: man realloc
18.   How can you increase the size of a statically allocated array?
: you can't, not easily anyway, you can put it into another statically allocated array but that's not much fun. man malloc, otherwise.
19.   When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
: if you mean if you have a pointer to a malloc'd section of memory and you realloc it, the pointer still points to the right addrss, but the actual address *may* change.
20.   What is object file? How can you access object file?
: something less than an executable. if you know assembler you can disassemble it.
21.   What do the functions atoi(), itoa() and gcvt() do?
: man atoi, man gcvt (itoa does the opposite of atoi, but it's nonstandard)



 

Answer by BAPPA
Submitted on 1/5/2005
Rating: Not yet rated Rate this answer: Vote
when we initialize any pointer to null
that mean not point to any thing
now if we are trying to access mean use
or try to put some value to it then the
error null pointer assignment occur
for example
int *p=null;
int mean p does not point to any
other memory location
now if we write
*p=2;// or any integer
error null pointer assignment

 

Answer by deepti
Submitted on 5/25/2005
Rating: Not yet rated Rate this answer: Vote
please do not give incorrect answers . Especially the answers given by some .. " oh come on" are totally incorrect . if u dont have work , time pass i n some other fashion , rather than giving incorrect answers to the basic Q.

 

Answer by gaudi
Submitted on 6/27/2005
Rating: Not yet rated Rate this answer: Vote
I am getting '"null pointer assignment" exception in C++(DOS) in the program in which I have made linklist of 300 nodes with each 217 bytes long.
I have 128MB RD RAM.
Can you tell me reason for this error?  

 

Answer by valli
Submitted on 7/8/2005
Rating: Not yet rated Rate this answer: Vote
4.  c for counting and v for vector

 

Answer by Arup Kumar Das
Submitted on 9/2/2005
Rating: Not yet rated Rate this answer: Vote





 

Answer by Gitendra Nandan Sahay
Submitted on 10/7/2005
Rating: Not yet rated Rate this answer: Vote
A 'Null Pointer Assignment' error is generate only in small and medium memory models. This error ocures in programs , which attempt to change the bottom of the data segments.

 

Answer by easy...
Submitted on 3/22/2006
Rating: Not yet rated Rate this answer: Vote
null pointer assignement is something like..in data segment at location 0000
microsoft borland copyright notice will be there... so at the termination of any process it will be checked if some body has tried to overwrite that location...in such case this error will be shown...

eg : int *i=NULL;
// some statements...
//now u forgot that i is assigned with null
  
     *i=10; //here comes the error..

 

Answer by easy...
Submitted on 3/22/2006
Rating: Not yet rated Rate this answer: Vote
null pointer assignement is something like..in data segment at location 0000
microsoft borland copyright notice will be there... so at the termination of any process it will be checked if some body has tried to overwrite that location...in such case this error will be shown...

eg : int *i=NULL;
// some statements...
//now u forgot that i is assigned with null
  
     *i=10; //here comes the error..

 

Answer by Anmol
Submitted on 7/11/2006
Rating: Not yet rated Rate this answer: Vote
I think the answer to the question no. 11 (as well as 14) is AND operator not OR
Plz Confirm the rest.

 

Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.


Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.

 

FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.

 

<< Back to: comp.lang.c Answers to Frequently Asked Questions (FAQ List)


[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.