In C/C++ sizeof() operator is used to find size of a date type or variable. Expressions written in sizeof() are never executed.
Even if we assign a value inside sizeof(), the changes are not reflected.
Output: a = 5, b = 4
This article is contributed by Nishu Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Is sizeof for a struct equal to the sum of sizeof of each member?
- Functions that are executed before and after main() in C
- sizeof operator in C
- Why does sizeof(x++) not increment x in C?
- Implement Your Own sizeof
- sizeof() for Floating Constant in C
- Do not use sizeof for array parameters
- Operands for sizeof operator
- How to find size of array in C/C++ without using sizeof ?
- Difference between strlen() and sizeof() for string in C
- Written version of Logical operators in C++
- Strict Aliasing Rule in C with Examples
- Difference between cout and puts() in C++ with Examples
- Difference between forward list and list in C++