A
Amkcoder
Amkcoder said:
You have been shown several counterexamples. Here are a few to refresh your
memory:
malloc(256)
myarray + offset
&integerobject
printf
None of these pointers is a variable that holds the address of another
variable. So now you have three choices:
1) accept that you're wrong;
2) explain why the counterexamples don't apply;
3) neither of the above.
1) and 2) are both honourable options, but 3) just suggests that you don't
know what you're talking about.
Not true. For example, here's a declaration of a pointer that doesn't
allocate any bytes at all:
extern int *p;
Why? You have not yet convinced me that you have the slightest idea what
you're talking about.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
A byte, typicaly, as the most common systems I have used is 8-bits in
length.
As is confirmed at wikipedia http://en.wikipedia.org/wiki/Byte
On x86 architecture based systems and compatibles,
it is confirmed that a word is two contiguous bytes,
each of which have their own address,
and the lower of the addresses is the address of the word.
This makes a 16-bit value.
As can be seen in this archecture it requires a double word (32-bit
binary value)
to represent every address,
for it can address up to 2^32-1 bytes,
and as can be seen a double word contains 32-bits having
a maximum value of 2^32-1 when unsigned
, for on these systems each address refers to a byte.
To program on the x86 architecture it is requisite knowledge.
This is the most common of architectures, so to be a real programmer,
capable working in the real world on most systems,
you'll need this manual for the 80386, or the newer ones:
http://www.cs.ucla.edu/~kohler/class/aos-f04/ref/i386.pdf
PS, the applications programming section, chapter on datatypes
confirms all that I have said in the above pdf.
This proves I am a programmer, capable of programmer x86 based
processors.
So if you have a x86 based processor, which you most likely do,
compile and run the following:
It will print out the value 666, and the size (in bytes) of a short
int,
on your x86 system. Enjoy:
#include <stdio.h>
int main() {
short int a;
unsigned char *b=(unsigned char *)&a;
*b=154;
*(b+1)=2;
printf("%d \n",a);
printf("%d bytes for short int \n",sizeof(short int));
system("pause");
}