Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typedef for 2 dimensional array in C

Is there a way to typedef a 2 dimensional array in C? Something like:

typedef char[10][10] board;

This example doesn't compile. Is there any way to do it? Or any other solution?

like image 702
user2216190 Avatar asked Jul 21 '13 09:07

user2216190


Video Answer


1 Answers

Try this:

typedef char board[10][10];

Then you can define new array as this:

board double_array = {"hello", "world"}; 

It's the same with:

char double_array[10][10] = {"hello", "world"};
like image 112
Yu Hao Avatar answered Sep 17 '22 17:09

Yu Hao