Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Smita Kapse

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)\n", pt.x, pt.y);
}
main() {
   display_point((struct point) {10, 20});
}

Output

(10,20)

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.