In order to read a memory address you must hold a reference to that address. If the object at that address is a named object, then the object's name is a reference, thus we can simply take its address using the address-of operator (unary &):
int i = 42;
printf ("Variable i resides at memory address 0x%x\n", &i);
If we wish to store the address we must use a pointer variable of the appropriate type:
int* p = %i;
Like any other variable, a pointer variable has an address of its own, thus we can read its address:
printf ("Variable p resides at memory address 0x%x\n", &p);
To read the address being pointed at we simply examine the pointer's value:
printf ("Variable p refers to memory address 0x%x\n", p);
Note this address is the same as the address of i, the object being referred to (pointed at).
To read the value stored at the address being pointed at we must dereference the pointer (unary *). Dereferencing is also known as indirection because we are indirectly accessing the object's value:
printf ("Variable p refers to the value %d\n", *p); // e.g., 42
Pointers can refer to both named and anonymous objects. Anonymous objects are simply objects allocated on the heap at runtime. Since they don't exist at compile time we cannot name them:
int* anon = malloc (sizeof (int)); // allocate memory
Note that anon is the name of the pointer, not the object being pointed at.
printf ("The anonymous variable resides at memory address 0x%x\n", anon);
free (anon); // always release heap allocations as soon as we are finished with them!
Pointers also make it possible to pass memory addresses to and from functions (also known as pass by reference):
void f (int* p) {
}
int a = 42;
f (&a); // pass the address of a to the f() function
Note that all variables in C are passed by value, but when we pass a pointer by value we are passing an address and an address is a reference. Passing references is useful when the object being referred to cannot be efficiently passed by value. Typically this means any value that is larger than the word value of the underlying architecture (e.g., 4 bytes on a 32-bit system). Arrays in particular are never passed by value, hence an array implicitly converts to a pointer.
turbo is word to do the programming language in c & c++ and i do no about borland
Suggest you peruse the Borland newsgroups, there are some very experienced people there who could answer you. I don't use Borland C, but Borland C++ Builder, and they have a Wizard that can build a project from VC projects included. Good luck, M
An address in C or C++ is the location in memory of an object or function. An address is the contents of a pointer, as opposed to the contents of the memory location pointed to by the pointer.
Borland.
Wherever you want to. Provided you have an e-book reader, and you have got the book on it.
Edmund W. Faison has written: 'Borland C [plus plus] 4 object-oriented programming' 'Borland C++ 3 object-oriented programming' -- subject(s): Borland C++, C++ (Computer program language), Object-oriented programming (Computer science) 'BorlandC[plus plus] 4.5 object-oriented programming' -- subject(s): Borland C., C., Object-oriented programming (Computer science) 'Borland C++ 3.1 object-oriented programming' -- subject(s): Borland C++, C++ (Computer program language), Object-oriented programming (Computer science)
A company called Borland. (Actually it was based on the former product Wizard C of Bob Jervis.)
Jason Vokes has written: 'Borland C++Builder 3 for dummies' -- subject(s): Borland C++Builder, C++ (Computer program language)
It has no use in C++ itself, it is only useful in Borland Turbo C++. It provides generic graphics support for Borland Turbo C++ applications.
No. But programs compiled with Borland compilers might be able, platform-dependent.
The company Borland developed Turbo C++.
Use functions like fopen, fclose, fgets, sscanf, strtok