
In this section we will see what is the compound literals in C. The compound literals are introduced in C99 standard in C. Using this feature, it can create unnamed objects. In the following example we will see how to use compound literal to generate object without any name.
Example
#include<stdio.h>
struct point {
int x;
int y;
};
void display_point(struct point pt) {
printf("(%d,%d)<p>", pt.x, pt.y);
}
main() {
display_point((struct point) {10, 20});
}</p></stdio.h>
输出
(10,20)
13万字C语言保姆级教程(深入):立即使用
在学习笔记中,你将探索c语言的核心概念和高级技巧!











