C Programming - Pointers - Discussion

Discussion Forum : Pointers - General Questions (Q.No. 5)
5.
If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
.
&
*
->
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
60 comments Page 3 of 6.

Siddhant said:   1 decade ago
For structure...we have to point to the struct variables's data member..that why..-> is used....in structure for pointer representation.

Jatin said:   1 decade ago
Here we can use arrow operator to access structure members without creating structure variable that's why we used -> (arrow) operator.
(1)

Pramod shinde said:   1 decade ago
Finaly to normal structure variable we can use "."operator and to pointer type variable we can use "->"Operator.

Supriya said:   1 decade ago
Can any one help me by telling how execute programs on India bix (c) through online compiler by giving my own input at command prompt.

Ranjansharan said:   1 decade ago
Can anybody say what is the actual difference, when we acces the member of struct by using "." operator & "->" operator ?

Vijaya said:   1 decade ago
When we create structure as a pointer, we have to access those structure members with structure object->structure variable.

Dhanalakshmi said:   1 decade ago
An individual structure member can be accessed in terms of its corresponding pointer variable by writing.

ptr -> member.

Appala prathyusha said:   1 decade ago
In the ex given by @Puja I have executed the program in online C compiler and executor. I got the output 0.

Sanket joshi said:   1 decade ago
. operator use when we have to acces stru member with array.

-> when we have to acces with pointer.

Rakesh said:   1 decade ago
@sidesh:

In the above code instead of writing t->val=20;,

we can write
(*t).value=20; thats it..


Post your comments here:

Your comments will be displayed after verification.