
- 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
Difference between 'struct' and 'typedef struct' in C++ program?
Basically struct is used to define a structure. But when we want to use it we have to use the struct keyword in C. If we use the typedef keyword, then a new name, we can use the struct by that name, without writing the struct keyword.
In C++, there is no difference between 'struct' and 'typedef struct' because, in C++, all struct/union/enum/class declarations act like they are implicitly typedef'ed, as long as the name is not hidden by another declaration with the same name.
Though there is one subtle difference that typedefs cannot be forward declared. So for the typedef option, you must include the file containing the typedef before it is used anywhere.
- Related Questions & Answers
- Difference between 'struct' and 'typedef struct' in C++?
- Difference between 'include' and 'extend' in Ruby
- What is difference between '.' , '?' and '*' in Python regular expression?
- The difference between 'AND' and '&&' in MySQL?
- Write the main difference between '==' and '===' operators in javascript?
- what is the main difference between '=' and '==' operators in javascript?
- What is the difference between 'isset()' and '!empty()' in PHP?
- What is the difference between 'log' and 'symlog' in matplotlib?
- What is the difference between 'throw new Error' and 'throw someObject' in javascript?
- What is the difference between the 'COPY' and 'ADD' commands in a Dockerfile?
- Update 'a' record with 'b' and 'b' with 'a' in a MySQL column (swap) with only 'a' and 'b' values?
- What is the difference between 'except Exception as e' and 'except Exception, e' in Python?
- 'break' and 'continue' in forEach in Kotlin
- Program to find number of string we can make where 'a' can be 'a' or 'b', and 'b' remains 'b'in Python
- Finding the sum of two numbers without using '+', '-', '/', '*' in JavaScript
Advertisements