GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 218 of 453    Print  
Between a long pointer and a char pointer , which one consumes more memory? explain

  
Total Answers and Comments: 10 Last Update: July 20, 2009     Asked by: Raji 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 23, 2006 01:41:23   #1  
Mridul        

RE: Between a long pointer and a char pointer , which ...
Long pointer consumes more memory as it can go beond the memory limit of 1K. So more address more space.
 
Is this answer useful? Yes | No
June 24, 2006 02:08:57   #2  
kannan        

RE: Between a long pointer and a char pointer , which ...

NO doubt in this...

always pointer variable is going to store a memory location.... its not a matter its long or char or int or any thing...

so this two is taking same amount of memory.


 
Is this answer useful? Yes | No
July 04, 2006 06:33:42   #3  
krishna reddy        

which occupies more memory either longpointer or charpointer

Both will consume same amount of memory.why because they means long or char pointer always stores the address of the character or long integer .

Thanks for reading my opinion.


 
Is this answer useful? Yes | No
July 07, 2006 08:15:17   #4  
aruneshwar        

RE: Between a long pointer and a char pointer , which ...

Whatever may be the pointer (whether it points to char int or float) the memory allocated is same i.e 2 bytes


 
Is this answer useful? Yes | No
July 19, 2006 12:42:08   #5  
vignesh007 Member Since: July 2006   Contribution: 4    

RE: Between a long pointer and a char pointer , which ...

1) As We All Know That Pointer(*) Holds Address!

2) Address is Always INTEGER (2-Bytes)

3) Hence 2-Bytes Are Allocated For Any Data Types!

vignesh007@msn.com - Vignesh 980 13 15 15


 
Is this answer useful? Yes | No
August 20, 2006 06:58:40   #6  
shaanxxx        

RE: Between a long pointer and a char pointer , which ...
pragmatic approach is the best approach. Just to support above comment.printf( d sizeof(long *));printf( d sizeof(char *));printf( d sizeof(double *));
 
Is this answer useful? Yes | No
August 20, 2006 12:44:32   #7  
Hinstings Member Since: August 2006   Contribution: 4    

RE: Between a long pointer and a char pointer , which ...
I think pointers take 4 bytes in a 4GB virtual memory space which is true for most of the OS in nowadays.
 
Is this answer useful? Yes | No
July 07, 2008 06:44:51   #8  
jintojos Member Since: May 2008   Contribution: 29    

RE: Between a long pointer and a char pointer , which one consumes more memory? explain
Both the long pointer and char pointer consumes the same memory.
By declaring variable as a long pointer means that it contains the address of another long variable and also for char pointers it contains the address of another char variable.
So all normal pointers have only two bytes for storing the address.

 
Is this answer useful? Yes | No
July 20, 2009 00:43:34   #9  
abhimanipal Member Since: July 2009   Contribution: 22    

RE: Between a long pointer and a char pointer , which one consumes more memory? explain
If the question is regarding the data type long and the data type char then both long pointer and char pointer occupy the same space ie 2 bytes

But I think in C there is a special kind of pointers called long pointers. These pointers are more than 2 bytes in size. Hence they can hold the address of the variables which are quite far away. Hence the name long pointer

 
Is this answer useful? Yes | No
July 20, 2009 01:17:19   #10  
abhimanipal Member Since: July 2009   Contribution: 22    

RE: Between a long pointer and a char pointer , which one consumes more memory? explain
I am sorry the 2 part of the above answer is wrong.....

I confused long pointer with far pointer

SIze of long pointer and char pointer will be the same

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape