Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2231

'.' : left operand points to 'class-key', use '–>'

The operand to the left of the member-selection operation (.) is a pointer instead of a class, structure, or union.

The following sample generates C2231:

// C2231.c
struct S {
   int member;
} s, *ps = &s;
int main() {
   ps.member = 0;   // C2231

   // OK
   ps->member = 0;   // crash
   s.member = 0;
}

Community Additions

ADD
Show:
© 2015 Microsoft