Initializing variable length array [duplicate]
This question already has an answer here: C compile error: “Variable-sized object may not be initialized” 7 answers C error “variable-sized object may not be initialized” [duplicate] 3 answers gcc complains: variable-sized object may not be initialized 3 answers On initializing a Variable length array compiler gives an error message: [Error] variable-sized object may not be initialized Code snippet: int n; printf("Enter size of magic square: "); scanf("%d",&n); int board[n][n] = {0}; How should Variable Length arrays be initialized? And why it's all elements are not initialized to 0 in the way