Why need a dot between structure variable and structure member ?
as can see p1.x and p1.y What does it meansCode:#include<stdio.h> struct Point { int x, y; }; int main() { struct Point p1; p1.x = 13; p1.y = 14; }
Why need a dot between structure variable and structure member ?
as can see p1.x and p1.y What does it meansCode:#include<stdio.h> struct Point { int x, y; }; int main() { struct Point p1; p1.x = 13; p1.y = 14; }
p1.x means the member named x of the struct (or union) object named p1.
If there was no dot, then it would be impossible to differentiate between this and a variable named p1x.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)