Anything written in sizeof() is never executed in C Last Updated : 02 Oct, 2017 Comments Improve Suggest changes 33 Likes Like Report In C/C++ sizeof() operator is used to find size of a date type or variable. Expressions written in sizeof() are never executed. Examples: C // C program to demonstrate that the // expressions written in sizeof() are // never executed #include <stdio.h> int main(){ // The printf in sizeof is not executed // Only the return type of printf is // considered and its size is evaluated // by sizeof, int a = sizeof(printf("hey")); printf("%d", a); return 0; } Output: 4 Even if we assign a value inside sizeof(), the changes are not reflected. C // One more C program to demonstrate that // the expressions written in sizeof() are // never executed #include <stdio.h> int main() { int a = 5; int b = sizeof(a = 6); printf("a = %d, b = %d\n", a, b); return 0; } Output: a = 5, b = 4 Comment N Nishu 33 Improve N Nishu 33 Improve Article Tags : C Language cpp-sizeof Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C5 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C6 min readArrays & StringsArrays in C6 min readStrings in C6 min readPointers and StructuresPointers in C9 min readFunction Pointer in C6 min readUnions in C4 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like