Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to pass an array by reference in C++

void func (int arr[])
{
  for(int i=0;i<arr.size();i++)
    arr[i]=1;
}
int main()
{
	int arr[100];
  	func(arr);
}
Comment

how to pass arrays by reference c++

#include <iostream>
using namespace std;
void show( int *num) {
   cout<<*num;
}
int main() {
   int a[] = {3,2,1,6,7,4,5,0,10,8};
   for (int i=0; i<10; i++) {
      show (&a[i]);
   }
   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: while loop in c++ 
Cpp :: How to get the last element of an array in C++ using std::array 
Cpp :: c++ multi-dimensional arrays 
Cpp :: sort c++ array 
Cpp :: vector remove class 
Cpp :: int to string Using to_string method 
Cpp :: c++ split string by sstream 
Cpp :: cpp queue 
Cpp :: while loop c++ 
Cpp :: Find first and last digit of int 
Cpp :: x += c++ 
Cpp :: vector erase iterator 
Cpp :: nazi crosshair c++ 
Cpp :: why ostream cannot be constant 
C :: how to use gotoxy in c language 
C :: get file extension from base64 string 
C :: vscode arduino [Warning] Output path is not specified. Unable to reuse previously compiled files. Upload could be slow. See README. 
C :: c program for threaded binary tree 
C :: how to auto run something on cmd 
C :: boilerplate code c 
C :: for loop c 
C :: strcasecmp in c 
C :: va_list in c 
C :: %d in c 
C :: sequelize count multiple associations 
C :: Hello world in C programming language 
C :: input array elements in c 
C :: get float in c 
C :: lateinit kotlin 
C :: how to use malloc in c 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =