View Full Version : what does -> mean in C?
November 8th, 2007, 06:14 AM
Hi just looking through some tutorials and came across this symbol:
just wondering what it means, thanks.
November 8th, 2007, 06:19 AM
It is used when you have a pointer to a structure and you want to dereference one of the stuct's fields.
ptr = &example;
ptr->a = 'A';
ptr->b = 1;
(*ptr).a = 'B';
(*ptr).b = 2;
November 8th, 2007, 03:12 PM
In case it isn't clear from yabbadabbadont's post, the
"->" syntax is syntactic sugar for "(*ptr)." .
are equivalent, where the former was introduced strictly for convenience.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.