Home > Back-end > Compound literals have common understanding?
Compound literals have common understanding?
Time:01-30
Please see my popular understanding is correct, as follows, One is in memory of the 2 x2 int array, no name, only address, also need to record in time to the pointer variable, or throw into a function's parameter, One is in memory of the 2 x2 int array, name is an array,
So popular said, the array of compound literal is nameless?
Int main () { Int * p=(int [2] [2]) { {10, 20}, {30, 40} }; An int array [2], [2]={ {10, 20}, {30, 40} }; return 0; }
CodePudding user response:
Following this code, is a nameless compound literals, generate only god knows where it is later, like throwing the drift bottle into the sea, is it?
int main () { (int [2] [2]) { {10, 20}, {30, 40} }; return 0; }
CodePudding user response:
According to your topic, I found a good magic, Int main () {
(int [3]) {7,8,9}; Printf (" % d \ t ", * $S1); Printf (" % d \ t ", * $S1 + 1); Printf (" % d \ t ", * $S1 + 2); return 0; } ///// 7 8 9 //// How to have such a strange thing? You can try the TC compilation,, whether can only VS can compile,
CodePudding user response:
Is not necessarily the array, also can be a structure, or even structure arrays,
CodePudding user response:
Compound literals is not only an array Line structure also A single int or Create an anonymous object that understand no problem Limited array is superfluous idea