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.


C program to sort all elements of a 4x4 matrix?

This type of sorting can b performd by simply transferring all the matrix elements in a single dimension array of 1X16 size and then sorting this array and then transferring the elements back to 4X4 matrix. You can also treat the 4x4 matrix as a simple array using pointers and, thus, not need to transfer from matrix to array and back. Example, using ellipses (...) to simulate indentation for clarity... int matrix[4][4] = {...some values...} int *element; int flag = 1; while (flag == 1) { /* simple bubble sort */ ... flag = 0; ... /* loop from first element to next to last element */ ... for (element = &matrix[0][0]; element < &matrix[3][3]; element ++) { ... ... if (*element > *(element + 1)) { ... ... ... flag = 1; ... ... ... *element ^= *(element + 1); /* exclusive or swap */ ... ... ... *(element + 1) ^= *element; ... ... ... *element ^= *(element + 1); ... ... } ... } }

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


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

yes


How can I use PyMOL to add hydrogens to a molecular structure?

To add hydrogens to a molecular structure using PyMOL, you can use the "hadd" command followed by the selection of the atoms you want to add hydrogens to. This command will automatically add hydrogens to the selected atoms in the molecular structure.


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.


What is a sentence using the word selected?

I selected a garbage-can over a banana.