answersLogoWhite

0

The following two do the same thing:

1. (*structure_pointer).field

2. structure_pointer->field

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Role of data structure to insert an element in the data structure?

using data structure an element can insert at any position easily. with out traversing through the entire list.


How do you implement stack without array?

Stacks are often implemented using the same node structure as a linked list.


What are the applications of pointers in using c language?

Accessing data by address. Some data-structures, like lists and trees, are usually implemented using pointers.


What do you use to supplement your current testing methods with the ability to flag memory leaks and unassigned pointers you use?

I have no need to flag memory leaks or unassigned pointers because I eliminate all leaks at source by using resource handles, smart pointers and making proper use of RAII.


Pointer to 3 dimensons array?

If the array is static you can simply point at the first element. For dynamic arrays you can allocate a contiguous block to a single pointer which can then be subdivided using a one-dimensional array of pointer to pointers, each of which points to a one-dimensional array of pointers, each of which points to a separate object within the array. For extremely large arrays, however, it is better to split the elements into separate one-dimensional arrays, by creating a one-dimensional array of pointer to pointers first, then allocating each of those pointers to a separate one-dimensional array of pointers, each of which points to a separate one-dimensional array of objects. Either way, you must destroy all the individual arrays in the reverse order of creation.

Related Questions

What operator enables you to access structures members using pointers to the structure?

(*ptr).field or ptr->field


Role of data structure to insert an element in the data structure?

using data structure an element can insert at any position easily. with out traversing through the entire list.


What are restricted pointers in C99?

Using this you specify that two pointers can't point on the same address


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How do you implement stack without array?

Stacks are often implemented using the same node structure as a linked list.


Why are header files not required when using far and near pointers?

In C programming, header files are required. It doesn't matter if you are using near pointers, far pointers, both, or neither -- you still need header files. There is no connection between the necessity of header files and the pointers' size.


What are the applications of pointers in using c language?

Accessing data by address. Some data-structures, like lists and trees, are usually implemented using pointers.


What are the pointers in computer programming using c?

addresses


What are arithmetic operaters can be perform on pointer?

Arithmetic operators can be performed on pointers in C and C++ to navigate through arrays or memory blocks. The most common operations include addition and subtraction, which adjust the pointer's address by multiplying the integer value by the size of the data type it points to. Incrementing a pointer (using ++ or --) moves it to the next or previous element in the array, while subtracting two pointers yields the number of elements between them. However, using multiplication and division with pointers is not defined.


How do you find the biggest of n numbers using pointers in C?

yes


When do you use pointers in C?

There are many uses of pointer in C. Pointers are efficient and elegant to use. All string variables are pointers, and calling a function using a pointer allows the function to change the value globally. These are what you can do with pointers in C. 1) Returning multiple values by passing address of variables. eg. foo(&a,&b,&c); 2) When you want to modify the value passed to function. eg. scanf() function. int n; scanf("%d",&n); /* pass address of variable n so that scanf can change its value*/ 3) When you need to pass large data structure to function, it is more efficient to pass pointer to structure than passing the entire structure. If you don't want to modify the structure members, you can use 'const' keyword which the ANSI-complaint C compiler will either warn or give error if you modify. eg strlen(const char *str) in string library should not modify the content of str. 4) Implementing 'goto' data structures are easy with pointers. eg. linked-list,binary trees, hash table. 5) You can allocate dynamic memory using pointers. 6) Pointers to function are used for call back function and jump table. eg qsort() and bsearch() functions require the caller to provide pointer to function to do the comparison.


How can you find factorial of each element in array using pointer?

To find the factorial of each element in an array using pointers in C, you can create a function that takes a pointer to the array and its size as parameters. In the function, iterate through the array using pointer arithmetic, calculating the factorial for each element and storing the result back in the same array or a separate array. For calculating the factorial, you can use a simple loop or recursion. Finally, print or return the modified array with the factorials.