![]() |
|
#1
|
|||
|
|||
array of pointers to ......I want to declare an array of pointers to arrays of characters.and then I want the user to enter these pointers , is such a thing possible?
Well ive written a test program which asks the user to enter 2 pointers(a or b) in any order he\she wants , then the program is supposed to go and print the array that each pointer points to! Here’s the code(I don’t get any errors but it simply doesn’t execute): CPP / C++ / C Code:
well? |
|
#2
|
|||
|
|||
|
Quote:
Pointers are memory addresses, and access to memory is controlled by the program and/or operating system, not the user. So it is not, in general, possible for users to give values to pointers that can be used to access arbitrary memory locations. Note also that pointer values that you can print out using standard C library I/O routines are "virtual memory" addresses, not actual physical memory addresses. If you know that a given virtual address is valid for your program (by printing out the value of a pointer to a variable in your program), then you can assign that value to a pointer and you can access that memory location. But I must emphasize: that memory address is relative to the starting address of a block of memory that was given to your program at the time the program was loaded for execution, and there is no way that a user program can know the physical memory location associated with the pointer value within the program. In fact, for hosted environments with modern operating systems such as Windows XP or Linux, user programs can not directly access any physical resources (memory addresses, I/O controller port address, video RAM, etc.) There may be specific API (Applications Programming Interface) functions designed so that Debugger programs can get to the low-level hardware. Or there may be shared library routines that can be linked into programs to allow access to physical resources under some defined interface specification. For embedded systems and other "real mode" programs running without memory-managed operating systems, it is possible in a C program to specify memory addresses, I/O addresses, etc. directly and access the resources through pointers with the given values. Regards, Dave |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 18:35 |
| template comiling problems - need expert debugger! | crq | CPP / C++ Forum | 1 | 01-Feb-2005 21:26 |
| array of pointers to strings | mirizar | CPP / C++ Forum | 5 | 21-Jan-2005 10:24 |
| Function and Array (w/ reference variables) question | brookeville | CPP / C++ Forum | 15 | 07-Dec-2004 01:11 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The