How to Initialize Array of Pointers in C? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Arrays are collections of similar data elements that are stored in contiguous memory locations. On the other hand, pointers are variables that store the memory address of another variable. In this article, we will learn how to initialize an array of pointers in C. Initialize Array of Pointers in CWe can simply initialize an array of pointers by assigning them some valid address using the assignment operator. Generally, we initialize the pointers that currently do not point to any location to a NULL value. This helps us avoid bugs such as segmentation faults. C Program to Initialize an Array of Pointers C // C program to initialize array of pointers #include <stdio.h> int main() { // declare an array of pointers to store address of // elements in array int* ptr[4]; // initializing the pointers to the NULL for (int i = 0; i < 4; i++) { ptr[i] = NULL; } // Print the elements and the address of elements stored // in array of pointers for (int i = 0; i < 4; i++) { if (ptr[i]) printf("ptr[%d] = %d\n", i, *ptr[i]); else printf("ptr[%d] = NULL\n", i); } return 0; } Outputptr[0] = NULL ptr[1] = NULL ptr[2] = NULL ptr[3] = NULL Time Complexity: O(N) where N is the number of elements in the array of pointers.Auxiliary Space: O(N) Create Quiz Comment K khatoono54g Follow 0 Improve K khatoono54g Follow 0 Improve Article Tags : C Programs C Language C-Pointers C-Arrays C-Dynamic Memory Allocation +1 More 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 C5 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