Anybody,please explain it......
2 Replies
>
In C/C++
The dot (.)
operator is used for direct member selection via object name. In other words, it is used to access the child object.
The dot operator is used when we want to access some data within a struct.
#include <stdio.h>
struct Pair {
int first, second;
};
int main(void) {
struct Pair p;
p.first = 10;
p.second = 20;
printf("%d %d\n", p.first, p.second);
}
For example, the above code implements a pair of integers.