passing 2d array as parameter to function in c
#include <stdio.h>
//passing 2D array as a parameter to a function
void fun(int *arr, int m, int n)
{
int i, j;
for (i = 0; i < m; i++){
for (j = 0; j < n; j++)
printf("%d ", *((arr+i*n) + j));
printf("\n");
}
}
int main(void)
{
int arr[][4] = {{1, 2, 3,4}, {4, 5, 6,7}, {7, 8, 9,0}};
int m = 3, n = 4; //m - no.of rows, n - no.of col
fun(&arr, m, n);
return 0;
}
Also in C:
- fwrite c
- create point cloud from rgbd image in open3d v0.10
- undefined reference to `cv::VideoCapture::VideoCapture(cv::String const&)'
- arduino knn
- georgia institute of technology
- Declare macro
- intellij idea
- resto de division recursiva
- char to int c
- get chunks of a mp4 in ffmpeg
- convert string to uppercase in c
- unable to locate package dos2unix
- .\main.c:4:8: error: expected declaration specifiers or '...' before '\x6f726c64'
- simpy process return value
- pebble scripting Boolean expression
- 4k stogram chave
- RuntimeError: You must setup() the GPIO channel first
- C time
- coin row problem in linear time
- oop244
- strtoul C
- sbatch array set max jobs at once
- amazon kinesis disaster recovery
- semicolong after for() loop stackoverflow