Hi all, just a curious question...
Why pointers are used in C++ or other languages in order to produce a much higher "quality" code and in open source programming???

Member Avatar for MonsieurPointer

I don't know about "quality", but pointers are important if:

  1. You want to change the value of a variable in a function (references);
  2. You need to allocate memory at run time (e.g. dynamic arrays)
  3. You want to improve performance - by passing a variable as a const reference to a function, that variable is not temporarily copied inside the function (scope). This is particularly helpful if memory allocated for the variable is a very large amount

There are possibly hundreds of reasons out there, I just mentioned the ones that I know of.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.