Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ matrix as argument

//1.The parameter is a 2D array

int array[10][10];
void passFunc(int a[][10])
{
    // ...
}
passFunc(array);

//2.The parameter is an array containing pointers

int *array[10];
for(int i = 0; i < 10; i++)
    array[i] = new int[10];
void passFunc(int *a[10]) //Array containing pointers
{
    // ...
}
passFunc(array);

//3. The parameter is a pointer to a pointer

int **array;
array = new int *[10];
for(int i = 0; i <10; i++)
    array[i] = new int[10];
void passFunc(int **a)
{
    // ...
}
passFunc(array);
Comment

PREVIOUS NEXT
Code Example
Cpp :: cin.get vs cin.getline in c++ 
Cpp :: static_cast c++ 
Cpp :: bit c++ 
Cpp :: in c++ ++ how to write if without if 
Cpp :: c++ competitive programming mst 
Cpp :: opencv c++ hello world 
Cpp :: apply pca to dataframe 
Cpp :: calling struct to a struct c++ 
Cpp :: how to use string variable in switch case in c++ 
Cpp :: c++ merge sort 
Cpp :: how to clear console c++ 
Cpp :: c++ vector sort 
Cpp :: change to lowercase in notepad++ 
Cpp :: cpp list 
Cpp :: c++ typedef 
Cpp :: print vector of vector c++ 
Cpp :: c++ iterate map 
Cpp :: do while loop c++ loops continuously 
Cpp :: nth node from end of linked list 
Cpp :: cpp float to string 
Cpp :: how to store pair in min heap in c++ 
Cpp :: all possible permutations of characters in c++ 
Cpp :: int to hex arduino 
Cpp :: c++ standard library source 
Cpp :: joins in mysql use sequelize 
Cpp :: find index of element in array c++ 
Cpp :: C++ Volume of a Cylinder 
Cpp :: deep copy c++ 
Cpp :: sizeof’ on array function parameter ‘arr’ will return size of ‘int*’ [-Wsizeof-array-argument] 
Cpp :: how to compile opencv c++ in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =