
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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)\n", pt.x, pt.y); } main() { display_point((struct point) {10, 20}); }
Output
(10,20)
- Related Questions & Answers
- Literals in C#
- Integer literals vs Floating point literals in C#
- Octal literals in C
- Compound Assignment Operators in C++
- Compound assignment operators in C#
- What are literals in C++?
- Formatted string literals in C#
- User Defined Literals in C++
- C Program for compound interest?
- What are Boolean Literals in C++?
- What are Character Literals in C++?
- What are string literals in C#?
- What are integer literals in C#?
- Program to find compound interest in C++
- C Program for the compound interest?
Advertisements