473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

pointer size depends on what

how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
Jun 27 '08 #1
4 2040
kumar wrote:
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
The question does not make a lot of sense, the sizeof operator will tell
you in code, or consult your compiler and platform documentation.

--
Ian Collins.
Jun 27 '08 #2

"kumar" <ra*******@gmail.comwrote in message
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
It is just possible that different pointer types are different sizes, on
your system. Normally, however, a pointer is the size of an address
register, which means 16 bits on a 64K machine, 32 bits on a 4Gb machine,
and 64 bits on a large machine.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Jun 27 '08 #3
On May 26, 2:02 pm, "Malcolm McLean" <regniz...@btinternet.comwrote:
"kumar" <raman....@gmail.comwrote in message
how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register

It is just possible that different pointer types are different sizes, on
your system. Normally, however, a pointer is the size of an address
register, which means 16 bits on a 64K machine, 32 bits on a 4Gb machine,
and 64 bits on a large machine.

--
Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm
thanx, now i got
bye
Jun 27 '08 #4
On Mon, 26 May 2008 00:31:30 -0700 (PDT), kumar <ra*******@gmail.com>
wrote:
>how can i identefy the pointer size
means is taking 4 byte or 2 bytes , on what basis we can decide either
on processor or register
While processor type or register size may influence the compiler
writer to choose a size (or even different sizes), the writer is free
to choose any size as long as the compiler can generate the code to
correctly use that size. For example, many hardware systems use a
4-byte address. The compiler may use a 12-byte pointer and put range
checking information in the extra bytes. Once again, Compiler 1 need
not use the same approach as Compiler 2 and different versions of
Compiler 1 could use different approaches.

If you need to know before compiling, use the documentation for your
implementation. If your code needs to know, then use the sizeof
operator which will produce to the correct value every time.
Remove del for email
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gopal-M | last post by:
I have the problem with sizeof operator I also want to implement a function that can return size of an object. My problem is as follows.. I have a Base class, say Base and there are many class...
4
by: Bryan Parkoff | last post by:
I want to allocate pointer array into memory so pointer array contains ten pointers. It would be 4 bytes per pointer to be total 40 bytes. Looks like below for example. unsigned char* A = new...
4
by: Pushkar Pradhan | last post by:
I have some functions which take as i/p a buffer (it can be float, char, or 16 bit, int etc.). The result is another o/p buffer, its type is also flexible (it could be a float, char etc.). I try...
79
by: syntax | last post by:
what is the size of a pointer? suppose i am writing, datatype *ptr; sizeof(ptr); now what does this sizeof(ptr) will give? will it give the size of the
9
by: sangeetha | last post by:
Hello, Is there any performance difference in using of the following two declaration? int (*ptr); //Array of 10 int pointers int *ptr; // pointer-to-array of 10. Regards, Sangeetha.
33
by: siliconwafer | last post by:
What is size of pointer in C on DOS? is it sizeof(int ) or size of (long int)? If this ans is present in FAQ pls direct me to tht ouestion
48
by: yezi | last post by:
Hi, all: I want to record some memory pointer returned from malloc, is possible the code like below? int memo_index; int i,j; char *tmp; for (i=0;i<10;i++){
26
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
13
by: william | last post by:
code segment: long int * size; char entry; ............. size=&entry; ************************************* Gcc reported 'assignment of incompatible pointer type'.
19
by: =?iso-8859-1?b?VG9t4XMg0yBoyWlsaWRoZQ==?= | last post by:
Coming originally from C++, I used to do the likes of the following, using a pointer in a conditional: void Func(int *p) { if (p) { *p++ = 7; *p++ = 8;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.