can you please explain to me the advantages of using pointer to a pointer in C programming?.
I also dont know how i can use them.
try to give me an example.
Pointer to a pointer in C programming?
Here's the deal - pointers to pointers are the SAME as multidimensional arrays in any other language.
Consider this:
int[][] matrix;
This is a 2-d array of numbers, such as a reachability matrix for a graph. You need this 2-d array to perform operations such as finding the shortest path between 2 points, or finding the number of distinct paths, or any other graph-operation.
You can use pointers to pointers to simulate this kind of 2-d array. Look at this for more info:
http://computer.howstuffworks.com/c32.ht...
Reply:There are a number of applications the most common is to assign a ptr in a function.
e.g.
int assign_ptr(int **a)
{
*a = malloc(8);
return 1;
}
yeah it's a nonsense example but it shows the point.
flower menings
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment