passing 2d array as parameter to function in c
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:
- Title
- keras conv2d batchnorm
- Category
- C
- Title
- reverse function in c
- Category
- C
- Title
- factorial of a given number in c
- Category
- C
- Title
- version of libgcc
- Category
- C
- Title
- read files in c
- Category
- C
- Title
- hello world
- Category
- C
- Title
- c bit access union
- Category
- C
- Title
- how to remove \n from a string c
- Category
- C
- Title
- c copy string
- Category
- C
- Title
- c print hello world
- Category
- C
- Title
- windowns 10 allow ping
- Category
- C
- Title
- full screen on c
- Category
- C
- Title
- oop244
- Category
- C
- Title
- Couldn't create temporary file to work with
- Category
- C
- Title
- hostbuilder add environment variables
- Category
- C
- Title
- restapi
- Category
- C
- Title
- read a binary file c
- Category
- C
- Title
- arduino digital input pins
- Category
- C
- Title
- cantidad de digitos recursiva
- Category
- C
- Title
- es par
- Category
- C
- Title
- c vs python
- Category
- C
- Title
- c how to define a variable
- Category
- C
- Title
- ordenar un vector
- Category
- C
- Title
- c check if file was created
- Category
- C
- Title
- for loop c
- Category
- C
- Title
- can we write a program without main in c
- Category
- C
- Title
- c bitwise operators
- Category
- C
- Title
- what is size_t in c
- Category
- C
- Title
- factors using recursion
- Category
- C
- Title
- múltiplos entre dos numeros en c
- Category
- C
- Title
- how to print in c
- Category
- C
- Title
- potencia recursiva
- Category
- C
- Title
- how to write function in c
- Category
- C
- Title
- division recursiva
- Category
- C
- Title
- last element from list javascript
- Category
- C
- Title
- powershell list big files
- Category
- C
- Title
- update ubuntu in terminal
- Category
- C
- Title
- remove element queue
- Category
- C
- Title
- convert string to float c
- Category
- C
- Title
- change a attribute in dataframe
- Category
- C
- Title
- strcat in c
- Category
- C
- Title
- jock cranley
- Category
- C
- Title
- pangram program in c
- Category
- C
- Title
- Declaring Variables in C
- Category
- C
- Title
- typedef vs #define
- Category
- C
- Title
- how to rebasde
- Category
- C
- Title
- disable gnu++11 option
- Category
- C
- Title
- diagonales
- Category
- C
- Title
- /usr/bin/mandb: fopen /var/cache/man/7935: Permission denied
- Category
- C
- Title
- C why is is & nit used in scan f fr string
- Category
- C
- Title
- vbnet create and write on file
- Category
- C
- Title
- printf n characters c
- Category
- C
- Title
- accessing elements of 1d array using pointers
- Category
- C
- Title
- C/c drop mime
- Category
- C
- Title
- how to print a file c
- Category
- C
- Title
- chat c socket tcp geeksforgeeks
- Category
- C
- Title
- c check if array is empty
- Category
- C
- Title
- get a remote branch git
- Category
- C
- Title
- c value set to zero __memmove_avx_unaligned_erms
- Category
- C
- Title
- root in C
- Category
- C
- Title
- command line coursera
- Category
- C
- Title
- arduino define
- Category
- C
- Title
- c zero out array
- Category
- C
- Title
- random en c
- Category
- C
- Title
- docker pull command
- Category
- C
- Title
- function pointer c
- Category
- C
- Title
- 233 pounds to inr
- Category
- C
- Title
- c concatenate strings
- Category
- C
- Title
- how can i remove a specific item from an array
- Category
- C
- Title
- how to open chrome using cmd
- Category
- C
- Title
- program using if statement in c whether numnber is less eqaul to greater than 50
- Category
- C
- Title
- c defined value sum
- Category
- C
- Title
- select all file from date powershell
- Category
- C
- Title
- add border to image android
- Category
- C
- Title
- what is the meaningof noremap
- Category
- C
- Title
- xmlns='' was not expected
- Category
- C
- Title
- mongodb delete all documents
- Category
- C
- Title
- 'int' is not a subtype of type 'double' dart
- Category
- C
- Title
- delete string function in c
- Category
- C
- Title
- array length c
- Category
- C
- Title
- Fibonacci program c pthread
- Category
- C
- Title
- How to make a printf in c
- Category
- C
- Title
- -> operator
- Category
- C
- Title
- confirm sweet alert
- Category
- C
- Title
- strtok
- Category
- C
- Title
- how to store a user input with spaces in c
- Category
- C
- Title
- curl post request
- Category
- C
- Title
- mostrar lista recursiva
- Category
- C
- Title
- ModuleNotFoundError: No module named 'cv2'
- Category
- C
- Title
- how to declare 2 d array using malloc
- Category
- C
- Title
- '&&' within '||'
- Category
- C
- Title
- how to do Employing defensive code in the UI to ensure that the current frame is the most top level window
- Category
- C
- Title
- code wars responsable drinker
- Category
- C
- Title
- use of matplotlib inline
- Category
- C
- Title
- error: ‘cout’ was not declared in this scope
- Category
- C
- Title
- doubly linked list c
- Category
- C
- Title
- read from stdin c
- Category
- C
- Title
- how to create an array of char in c++
- Category
- C
- Title
- too few arguments to function in c
- Category
- C
- Title
- how to sleep in c
- Category
- C