What is the size of pointer ?
Also size of pointer in 64 bit pointer
Answers were Sorted based on User's Feedback
Answer / shraddha
The size of pointer is 2 bytes on 16 bit platform
The size of pointer is 4 bytes on 32 bit platform
The size of pointer is 8 bytes on 64 bit platform
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / kunal mittal
Size of the pointer often corresponds to the architecture
Using a 32-bit OS gives you a 32bit pointer (ditto for 64 bit)
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / shakti singh khinchi
Ans1: Size of a pointer is size of a WORD in OS. OR you can
say that size of a pointer is similar to size of a "int"
variable on that OS.
Ans2: size of 64 bit pointer is also similar to size of an
integer type variable that is 8 bytes.
Is This Answer Correct ? | 0 Yes | 1 No |
How do you show the declaration of a virtual constructor?
What is the exit function in c++?
What is a hash function c++?
Should I learn c or c++ or c#?
What is std namespace in c++?
how can i access a direct (absolute, not the offset) memory address? here is what i tried: wrote a program that ask's for an address from the user, creates a FAR pointer to that adress and shows it. then the user can increment/decrement the value in that address by pressing p(inc+) and m(dec-). NOW, i compiled that program and opened it twice (in 2 different windows) and gave twice the same address to it. now look what happen - if i change the value in one "window" of the program, it DOES NOT change in the other! even if they point to the same address in the memory! here is the code snippet: //------------------------------------------------------ #include <stdio.h> //INCLUDE EVERY KNOWN HEADER FILE #include <conio.h> //FOR ANY CASE... #include <iostream.h> #include <dos.h> #include <process.h> main() { int far *ptr; //FAR POINTER!!! long address; char key=0; //A KEY FROM THE KEYBOARD int temp=0; clrscr(); cout<<"Enter Address:"; cin>>hex>>address; //GETS THE ADDRESS clrscr(); (long)ptr=address; temp=*ptr; //PUTS THE ADDRESS IN THE PTR cout<<"["<<hex<<(unsigned long)ptr<<"]="<<*ptr<<" = "<< (char)(*ptr); //SHOWS: [address]=value=ASCII symbol. while (key!=27) //WHILE YOU DONT PRESS ESC. { while(!kbhit()) //WHILE KEY IS NOT PRESSED { if (temp!=*ptr) { temp=*ptr; clrscr(); cout<<"["<<hex<< (unsigned long)ptr<<"]="<<*ptr<<" = "<<(char)(*ptr); }; //IF THE VALUE HAS CHANGED, CLEAR THE SCREEN AND SHOW //AGAIN if (key=='p') {key=0; (*ptr)++; } //INCREMENT VALUE if (key=='m') {key=0; (*ptr)--; } //DEC. VALUE }; key=getch(); //IF A KEY IS PRESSED, READ IT FROM THE //KEYBOARD }; return 0; //IF ESC WAS THE KEY, EXIT THE PROGRAM } //---------------------------------------------------------
What are the 2 main types of data structures?
Define pointers?
What are the advantages of using a pointer?
What is the difference between a type-specific template friend class and a general template friend class?
What is a pointer how and when is it used?
Why namespace is used in c++?