- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Anything written in sizeof() is never executed in C
The sizeof function (Sometimes called operator) is used to calculate the size of the given argument. If some other functions are given as argument, then that will not be executed in the sizeof.
In the following example we will put one printf() statement inside the loop. Then we will see the output.
Example
#include<stdio.h> double my_function() { printf("This is a test function"); return 123456789; } main() { int x; x = sizeof(printf("Hello World")); printf("The size: %d
", x); x = sizeof(my_function()); printf("The size: %d", x); }
Output
The size: 4 The size: 8
The printf() is not executed which is present inside the sizeof(). Only the return type is considered, and its size is taken.
Advertisements