#include <stdio.h>
#include <stdlib.h>
int** matrix_mul(int **s, int **t, int N);
int main(int argc, char** argv){
int A[3][3] = {
{1, 1, 2},
{1, 0, 1},
{0, 3, 0}
};
int B[3][3] = {
{2, 1, 3},
{1, 3, 2},
{1, 2, 0}
};
int *parr_A[3] = {A[0], A[1], A[2]};
int *parr_B[3] = {B[0], B[1], B[2]};
int **AB = (void*)0;
int i, j, N = 3;
printf("A : \n");
for(i = 0; i < N; i++){
for(j = 0; j < N; j++){
printf("%d ", A[i][j]);
}
printf("\n");
}
printf("B : \n");
for(i = 0; i < N; i++){
for(j = 0; j < N; j++){
printf("%d ", B[i][j]);
}
printf("\n");
}
AB = matrix_mul(parr_A, parr_B, N);
if(AB){
printf("A x B : \n");
for(i = 0; i < N; i++){
for(j = 0; j < N; j++){
printf("%d ", AB[i][j]);
}
printf("\n");
}
}
return 0;
}
int** matrix_mul(int **s, int **t, int N){
//여기 작성
}
#include <stdio.h>
int main(void)
{
int *i = (int *)malloc(sizeof(int) * 1000000);
int *count_i = (int *)malloc(sizeof(int) * 1000000);
int input;
scanf("%d", &input);
for (int sentinel = 0; sentinel < input; sentinel++)
{
scanf("%d", &i[sentinel]);
}
for (int sentinel = 0; sentinel < input; sentinel++)
{
count_i[sentinel] = i[input - sentinel - 1];
}
for (int sentinel = 0; sentinel < input; sentinel++)
{
printf("%d ", count_i[sentinel]);
}
printf("\n");
return 0;
}
#2
int **matrix_mul(int **s, int **t, int N)
{
int **M = (int *)malloc(sizeof(int)*N);
int value;
for (int sentinel = 0; sentinel < N; sentinel++)
*(M + sentinel) = (int *)malloc(sizeof(int)*N);
for (int sentinel = 0; sentinel < N; sentinel++)
{
for (int sentinel_2 = 0; sentinel_2 < N; sentinel_2++)
{
value = 0;
for (int sentinel_3 = 0; sentinel_3 < N; sentinel_3++)
{
value += s[sentinel][sentinel_3] * t[sentinel_3][sentinel_2];
}
M[sentinel][sentinel_2] = value;
}
}
return M;
}