top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the advantages of pointer over the array in c or c++?

+1 vote
4,833 views
What are the advantages of pointer over the array in c or c++?
posted Apr 28, 2016 by Sathyasree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+1 vote

Array is a Data Structure while pointer is a reference to any variable,array,structures etc. It is the uses of Pointers that can have some advantages over an array. For example a pointer variable can have the reference of an array of any type and one can easy perform array operations on array using pointers. In my opinion there is no such advantage of pointers over an array because array is data structure and pointer is reference variable. However using pointer is considered as very efficient in implementation of array, string handling,Linked List. In case of Linked list pointer is helpful in dynamic implementation whereas array size must be declared.

answer May 1, 2016 by Shahsikant Dwivedi
0 votes

Pointers are more efficient in handling arrays and data tables. They can be used to return multiple values from a function via function arguments. Pointers permit references to functions and thereby facilitating passing of functions as arguments to other functions. The use of po0inter arrays to character strings results in saving of data storage space in memory. pointers allow C to support dynamic memory management. Pointers provide an efficient tool for manipulating dynamic data structures such as structures, linked lists, queues, stacks and trees. Pointers reduce length and complexity of programs. They increases the execution speed and thus reduce the program execution time.

answer Apr 28, 2016 by Shivaranjini
0 votes

1: you can work with the address of the variable.
2: Function cannot return more than one value. But when the same function can modify many pointer variables and function as if it is returning more than one variable.
3:In the case of arrays, we can decide the size of the array at runtime by allocating the necessary space.
4: if you want to access a variable quickly or efficiently with out wasting c.p.u time you have only 2 ways..
one is declare it as a register variable...
and other one is declare it with a pointer....
because a c.p.u has less registers in it ( approximately 6 i.e A,B,C,D,E,F,G,H),
when no register are freely available then you CAN DO THAT TASK WITH ONLY POINTERS....
5:by using pointers you can improve the c.p.u's throughput time
(throughput time refers to no of jobs done by the c.p.u in unit amount of time)....
these are the advantages that can be acquired from pointers.

answer Apr 29, 2016 by Ajay Kumar
Similar Questions
+4 votes

What are the advantages of Vector over an array in C++? give Exmaple.

+4 votes

Can someone explain me the usage of function pointer? Probably with real time examples ?

...