Pointers and ARRAYS

An Introduction to Pointers

Pointers are the core of programming of Pointers. They allow direct access to the memory as well as the hardware, which let the programmer to write the code very efficiently hence making the code run n the machine very efficiently and fast.

Pointer is nothing but address in the memory, the programmer can use pointers for anything in C++, it helps in retaining single copy of the variables. It also comes with the drawback that is it is difficult to control; in this sometimes a pointer can leak the memory or data to the addresses outside the permitted boundary of the program. Get your solutions to all the pointers and arrays related assignment help and homework help solved by expert around the world.

Introduction to Arrays

An array in C / C++ is a collection of similar objects or data elements which are referenced by the common name. Generally, it is just another data type, aggregate data type or secondary data types or derived data types. These data elements occupy contiguous memory from the heap available and they are traversed by using an index but also each element can be identified. For example, instead of using mark1, mark2, .... mark100 for the 100 students of the class we can declare all the variables with the help of arrays like

                int mark[100];

Pointer in C/C++

Pointers are a programming tool that helps in improving program’s efficiency by allowing you to handle huge amount of data with ease. With help of pointer you can allocate memory dynamically without being concern about how much memory is being used.

What are pointers?

In simple word, a pointer is just a variable that stores the memory location of another variable. As the name indicates, it points to something, in programming terms, it points to a location in the memory. For better understanding please refer assignment help and homework help at Transtutors.com. The physical memory is numbered sequentially similar to lockers in a bank, these numbers are memory addresses


The below example demonstrate how to declare a pointer that stores the address of an integer.

Int *point_to_integer;

In above example, an asterisk is added directly before the variable name. The addition of asterisk directly before the variable name will declare them as a pointer. You can declare multiple pointers in the same line by preceding them with an asterisk.

Int *pointer1, *pointer2;

Sample code to calculate sum of array via use of pointers, get all your codes of assignment help and homework help solved in the given time and guidelines.

int get_total(int*, int);

int main()


     int n=7;

     int  total,  y[n]={6,9,2,4,5,23,12};

     cout<<"\nCalling function get_total(y, n),";

     total = get_total(y, n);

     cout<<"\nSum of the 7 array elements is "<<total<<endl;

     return 0;


      int get_total(int *ptr, int x)


     int  i, total = 0;



            cout<<*(ptr+i)<<" ";

            total += *(ptr+i);  // total=total + *(ptr+i);


     return total;


Understand Computer Science better with these Q&A

More Q&A
Submit Your Questions Here!
Copy and paste your question here...

Attach Files

Top Computer Science Online Experts