How to Find the Size of an Array in C? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The size of an array is generally considered to be the number of elements in the array (not the size of memory occupied in bytes). In this article, we will learn how to find the size of an array in C.The simplest method to find the size of an array in C is by using sizeof operator. First determine the total size of the array in bytes and divide it by the size of one element to get the number of elements. C #include <stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50}; // Total size divided by size of one element int n = sizeof(arr) / sizeof(arr[0]); printf("%d\n", n); return 0; } Output5 There is also one more method is C that can be used to find the size of an array in C.Using Pointer ArithmeticThe idea is to use pointer arithmetic to find the difference between the memory addresses of the first element of the array and the beyond the last which will be then automatically scaled by the compiler according to the type of array. C #include <stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50}; // Calculate the size int n = *(&arr + 1) - arr; printf("%d\n", n); return 0; } Output5 Note: All these methods only work as long as the array has not decayed into a pointer. Once it decays, it is treated as a pointer, and the size of the array can no longer be determined. Comment V vishalwaghmode33284 Follow 0 Improve V vishalwaghmode33284 Follow 0 Improve Article Tags : C Programs C Language cpp-sizeof C-Data Types C Array Programs C Examples +2 More 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