Initialization of a multidimensional arrays in C/C++ Program

C++Server Side ProgrammingProgramming

C in Depth: The Complete C Programming Guide for Beginners

45 Lectures 4.5 hours

Practical C++: Learn C++ Basics Step by Step

Most Popular

50 Lectures 4.5 hours

Master C and Embedded C Programming- Learn as you go

Best Seller

66 Lectures 5.5 hours

In this tutorial, we will be discussing a program to understand how to initiate a multidimensional array in C/C++.

While declaring a multidimensional array, the value of the leftmost dimension can be left empty, but all other dimensions must be provided.

Example

Live Demo

#include<stdio.h>
int main(){
int a[][2] = {{1,2},{3,4}};
printf("%lu", sizeof(a));
getchar();
return 0;
}

Output

16
Updated on 23-Mar-2020 08:39:05