2
In this code, I have a two-dimensional array(array), I started and I want to print with the printf, but I don’t know how:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int matriz1 [3][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int matriz2 [3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
for(i=0; i<12; i++) {
printf("%d\n", matriz1[i]);
}
system("pause");
return 0;
}
I tried with the for i<12 because it is size 12, but it displays other numbers.
Your question would be clearer if you showed what are the "other numbers" you are getting as output.
– hugomg
I’m trying to get the numbers declared in the matrix.
– user25145
I know what you are getting. It’s just that in general it also helps if you tell what are the wrong numbers that your program is printing.
– hugomg
But now I’ve rewritten the code, I don’t know anymore.
– user25145
Don’t worry. It was just a tip for your next question
– hugomg