I have already data in two dimensional matrix but some cell is empty.Now i want to put 0 in blank cell.
to put element in two dimensional array
Collapse
X
-
Are you sure those cells are empty? They may contain garbage values from memory. A solution would be to declare the array and already initialize all elements to 0 ( finishing the statement with = { 0 }; ) and then fill in the positions you want with data. That of course assuming your matrix is of a numeric data type. For example, to declare and initialize a matrix (with 10 rows and 5 columns) of the int data type with 0 in all positions:
Code:int matrix[10][5] = { 0 };
Comment
Comment