- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Compound Literals in C
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)
", pt.x, pt.y); } main() { display_point((struct point) {10, 20}); }
Output
(10,20)
- Related Articles
- Literals in C#
- Integer literals vs Floating point literals in C#
- Octal literals in C
- User Defined Literals in C++
- What are literals in C++?
- Formatted string literals in C#
- What are Boolean Literals in C++?
- What are Character Literals in C++?
- What are string literals in C#?
- What are integer literals in C#?
- Character constants vs String literals in C#
- What are floating point literals in C#?
- What are string literals in C language?
- Type difference of character literals in C vs C++
- Type difference of character literals in C and C++

Advertisements