Undefined behavior: when attempting to access the result of function call
The following compiles and prints "string" as an output. #include <stdio.h> struct S { int x; char c[7]; }; struct S bar() { struct S s = {42, "string"}; return s; } int main() { printf("%s", bar().c); } Apparently this seems to invokes an undefined behavior according to C99 6.5.2.2/5 If an attempt is made to modify the result of a function call or to access it after the next sequence point, the behavior is undefined. I don't understand where it says about "next sequence point". What's going on here? You've run into a subtle corner of the language. An expression of array type is, in most