3

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

4

1 回答 1

7

几乎正确,尊重本身不会导致复制,但分配会:所有结构元素都是浅复制的。

于 2013-07-03T14:15:32.350 回答