values for a 'bool' are 'true' and 'false', whereas for 'BOOL' you can use any 'int' value
bool - 1 byte BOOL - 4 byte ( 32 bit platform where 'int' = 4 bytes ) BOOL - 8 byte ( 64 bit platform where 'int' = 8 bytes )
 Posted by: Andy
Contact Author
The difference is 1. bool is a C++ native data type and has the size of i byte. Actually only 1 bit would suffice as the only valid values are TRUE or FALSE but nothing can have the size less that 1 Byte (leave bit fields apart) 2 whereas BOOL is a windows specific type of int, so its nothing but an int is disguise having size whatever int has on the system. Under C++ guidelines size of int is platform dependent so we leave it at that.
 Posted by: Samit Sasan
Contact Author
The reference is used to give the address for the data.The pointers are used to pointing to the address of the memory.
 Posted by: sunitha
Contact Author
Reference: is referring to another object, so if you modify the value of the referred object, also the reference's value will be changed: int a = 10; int&b = a; a = 5; // b = 5 too You cannot redirect b to another int variable. Reference is widely used as function parameters: while the default parmeter passing is by value, if you want to change the value of the passed parameter inside a procedure, it won't be modified when the function returns:
void increment(int i) { i++; return; }
void main() { int index = 0; increment(index) ; // index remains still '0' }
But if you use references, not the value, but the memory address will be transmitted to the function, which can so modify the value, and index will be 1: void increment(int& i)
Reference is also used for passing big objects as function parameters, for efficiency purposes (it won't be copied, so the storage and the runtime will be less). In this case const T& is used, where T is the object type.
Pointers: it points to an object in the memory. Main difference is that it can be redirected to another object. It has one more indirection level compared to reference: * is the dereference (or indirection) operator, and you can access through this operator the value of the pointed object. The pointer itself contains the memory address: int a = 10; int c = 6; int* p = &a; cout << *p; // same as cout << a; a = 5; // *p = 5 but p still referrs to 'a' p = c; // *p = 6 and p referrs to 'c'
 Posted by: Mona
Contact Author
1)A reference is constant, you can't bind to a different object once it has been initialized. 2)A reference must be initialized, whereas a pointer needn't be. 3)A reference must always point to a valid object, a pointer may be NULL 4)A reference is automatically dereferenced. You don't use *ref to access the actual object it is bound to 5) you can't create a reference to a reference. You can create a pointer to a pointer, though 6)Unlike a pointer, a reference is treated as if it were the object bound to it, i.e. you access members using the dot notation.