C++ - Why are pointers used so much?

In Java, all objects and arrays are reference types, which means that they can be passed around efficiently without explicitly having to declare pointer types. Under the hood, however, they, too, are being passed as pointers - you just don’t see it in the syntax.

In C++, objects and arrays are passed around as values. Using pointers is the idiomatic way of specifying that you want to refer to an object or array by reference, not by value. The C++ syntax requires you to be more specific as to whether you handle such objects by reference or by value, while in Java it is assumed to be by reference by default.

To be more specific, there are actually two reference type concepts in C++: pointers and references. Pointers are declared with a star (*) and references with an ampersand (&). A C++ pointer can be null, just like a Java object references can be null. A C++ reference on the other hand must always be assigned and can generally be assumed to be not null.