Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * prog.c
- *
- * Created on: Sep 29, 2016
- * Author: dastan.iyembergen
- */
- #include <stdio.h>
- void transpose(int row, int col, double orig[row][col], double result[col][row]){
- int i, j;
- for (i=0; i<row; i++){
- for (j=0; j<col; j++){
- result[j][i]=orig[i][j];
- }
- }
- }
- void printArr(int row, int col, double arr[row][col]){
- int i, j;
- for (i=0; i<row; i++){
- for (j=0; j<col; j++){
- printf("%5f ", arr[i][j]);
- }
- printf("\n");
- }
- }
- int main(){
- double orig[2][3]={{53.2, 546.2, 9},
- {2.5, 5.6, 11}
- };
- double result[3][2];
- transpose(2, 3, orig, result);
- printArr(3, 2, result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment