Reputation: 31
I've recently come across the following behaviour in C code for the first time:
struct tm brokenDownTime = *gmtime( &myTime );
gmtime returns a pointer to a tm structure and I can see that it's being dereferenced, am I right in assuming that the * is causing the structure to be copied?
Many thanks
Upvotes: 3
Views: 1124
Reputation: 234645
Almost correct, the deference itself doesn't cause the copy but the assignment does: all the structure elements are shallow copied.
Upvotes: 7