Output of C Program | Set 26 Last Updated : 27 Dec, 2016 Comments Improve Suggest changes 30 Likes Like Report Predict the output of following C programs. Question 1 C #include <stdio.h> int main() { int arr[] = {}; printf("%d", sizeof(arr)); return 0; } Output: 0 C (or C++) allows arrays of size 0. When an array is declared with empty initialization list, size of the array becomes 0. Question 2 C #include<stdio.h> int main() { int i, j; int arr[4][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16} }; for(i = 0; i < 4; i++) for(j = 0; j < 4; j++) printf("%d ", j[i[arr]] ); printf("\n"); for(i = 0; i < 4; i++) for(j = 0; j < 4; j++) printf("%d ", i[j[arr]] ); return 0; } Output: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 Array elements are accessed using pointer arithmetic. So the meaning of arr[i][j] and j[i[arr]] is same. They both mean (arr + 4*i + j). Similarly, the meaning of arr[j][i] and i[j[arr]] is same. Question 3 C #include<stdio.h> int main() { int a[2][3] = {2,1,3,2,3,4}; printf("Using pointer notations:\n"); printf("%d %d %d\n", *(*(a+0)+0), *(*(a+0)+1), *(*(a+0)+2)); printf("Using mixed notations:\n"); printf("%d %d %d\n", *(a[1]+0), *(a[1]+1), *(a[1]+2)); return 0; } Output: Using pointer notations: 2 1 3 Using mixed notations: 2 3 4 Comment K kartik Follow 30 Improve K kartik Follow 30 Improve Article Tags : C Language C-Output Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 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 C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C6 min readUnions in C3 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