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 2 of 6.

Kalidoss said:   2 decades ago
Pointers and Structures are used in the concept of Lined List, Stack, Queue ,etc.

In These Programs the address part or node is represented by the following
"obj->ptr"

Bhargavi said:   1 decade ago
enum is a one of the userdefined datatype,and it defines the list of keywords.

Ex:
enum rainbow
{
1.Red
2.Orange
3.Yellow
4.Green
5.Blue
6.Indigo
7.Violet
} ;

Sarvan said:   1 decade ago
@indhu

Pointer is just the address value, where the variable is stored. To get the address value we use "->" its just an representation. Hope you understand.
(1)

Anukul said:   1 decade ago
"." is not actually referred to as a "dot" operator....it is an "direct selector".

"->" is an "indirect selector".

Ameena said:   1 decade ago
Pointer definition: it can store the & of the another variable, so we are using pointer, using arrow "->", operator, ". ", dot operator are used in pointer.

Kamlesh sharma said:   1 decade ago
Pointer definition: it can store the & of the other variable, so we are using pointer, using arrow "->", operator, ". ", dot operator are used in pointer.

Deepak said:   5 years ago
@All.

The eg Syntax is;

struct node
{
int data;
};
main(){
struct node p,*a;
P.data=10;
a=&p;
printf(" %d",a->data);
}

And Output is 10.
(5)

AukI said:   1 decade ago
Kan you give some example @Kisan, you provided information is very understandable but it would be lot better, if you can post some examples to your thoughts.

Saurabh said:   1 decade ago
Pointer variable can also be accessible by two type
Type:1
(*a).p//if a is the pointer variable of p.
type:2
It can also be written same as..
a->p;

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


Post your comments here:

Your comments will be displayed after verification.