array as parameter c++
C++
void myFunction(int param[]) {
.
.
.
}
void generateArray(int *a, int si)
{
for (int j = 0; j < si; j++)
a[j] = rand() % 9;
}
int main()
{
const int size=5;
int a[size];
generateArray(a, size);
return 0;
}
Source:stackoverflow.comvoid generateArray(int *a, int si)
{
for (int j = 0; j < si; j++)
a[j] = rand() % 9;
}
int main()
{
const int size=5;
int a[size];
generateArray(a, size);
return 0;
}
Also in C++:
- Title
- primitive and non primitive data types in c++
- Category
- C++
- Title
- FInd the element which appears more than n/2 times C++
- Category
- C++
- Title
- arduino falling edge
- Category
- C++
- Title
- c++ random numbers
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- stoi c++
- Category
- C++
- Title
- varint index
- Category
- C++
- Title
- c++ iterate through constant list
- Category
- C++
- Title
- repeating character in c++
- Category
- C++
- Title
- compare values within within a vector c++
- Category
- C++
- Title
- passing array to function in c++
- Category
- C++
- Title
- dijkstra c++ geeksforgeeks using set
- Category
- C++
- Title
- pass vector by reference c++
- Category
- C++
- Title
- insert at position in vector c++
- Category
- C++
- Title
- c++ program for addition of two numbers using functions
- Category
- C++
- Title
- set precision in c++
- Category
- C++
- Title
- namespace c++
- Category
- C++
- Title
- recursive in c++
- Category
- C++
- Title
- cpp loop through object
- Category
- C++
- Title
- c++ class inheritance
- Category
- C++
- Title
- how to type cast quotient of two integers to double with c++
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- declare vectors c++
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- can we compare a long long int with int in c++ using max or min functions
- Category
- C++
- Title
- c++ overloaded equality check operator
- Category
- C++
- Title
- built in function in c++ for binary to decimal
- Category
- C++
- Title
- set lower bound c++
- Category
- C++
- Title
- lambda operator in c++
- Category
- C++
- Title
- c++ looping through a vector
- Category
- C++
- Title
- how to print nth palindrome number in c++
- Category
- C++
- Title
- delete a double pointer c++
- Category
- C++
- Title
- compare function in sort c++ stl
- Category
- C++
- Title
- Arrays hackerrank solution in c++
- Category
- C++
- Title
- how to find the number of cycles in a graph C++
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- c++ read file line by line
- Category
- C++
- Title
- how to compile opencv c++ in ubuntu
- Category
- C++
- Title
- error: ‘memset’ was not declared in this scope in cpp
- Category
- C++
- Title
- c++ initialize a vector
- Category
- C++
- Title
- user input c++
- Category
- C++
- Title
- print type cpp
- Category
- C++
- Title
- runtime error in c++
- Category
- C++
- Title
- matrix transpose tiling
- Category
- C++
- Title
- pass by reference c++
- Category
- C++
- Title
- lisy stl C++
- Category
- C++
- Title
- UPARAM(ref)
- Category
- C++
- Title
- how to find the size of a character array in c++
- Category
- C++
- Title
- dynamic 2d array c++
- Category
- C++
- Title
- command line options in c++
- Category
- C++
- Title
- All palindromic substrings
- Category
- C++
- Title
- set of vectors c++
- Category
- C++
- Title
- c++ program for matrix addition
- Category
- C++
- Title
- regexp_like oracle c++
- Category
- C++
- Title
- string substr c++
- Category
- C++
- Title
- phph date
- Category
- C++
- Title
- c++ tutorial
- Category
- C++
- Title
- time function c++
- Category
- C++
- Title
- c++ sort
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- c++ method name
- Category
- C++
- Title
- c++ char print align
- Category
- C++
- Title
- c++ reset stream
- Category
- C++
- Title
- how initilaize deffult value to c++ class
- Category
- C++
- Title
- how to initialize a vector in c++
- Category
- C++
- Title
- c++ initialize array
- Category
- C++
- Title
- variabili in c++
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- vector initialization c++
- Category
- C++
- Title
- how to iterate through array in c++
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- insert elements in array in c++11
- Category
- C++
- Title
- Check if a Number is Odd or Even using Bitwise Operators
- Category
- C++
- Title
- c++ get last element in vector
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- find in vector in c++
- Category
- C++
- Title
- initialise 2d vector in c++
- Category
- C++
- Title
- double ended queue in c++ stl
- Category
- C++
- Title
- how do for loops on c++
- Category
- C++
- Title
- random number generator c++
- Category
- C++
- Title
- runtime array size c++
- Category
- C++
- Title
- sqrt cpp
- Category
- C++
- Title
- how to extract substring from string in c++
- Category
- C++
- Title
- accumulate c++ stl
- Category
- C++
- Title
- c++ loop through int array
- Category
- C++
- Title
- max three values c++
- Category
- C++
- Title
- hashset in c++
- Category
- C++
- Title
- c++ dereference a pointer
- Category
- C++
- Title
- sorting of array in c++
- Category
- C++
- Title
- how to use winmain function
- Category
- C++
- Title
- preorder traversal c++
- Category
- C++
- Title
- char to string c++
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- namespaces c++
- Category
- C++
- Title
- widechartomultibyte
- Category
- C++
- Title
- remove element by index from vector c++
- Category
- C++
- Title
- retu7rn this c++
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- how to print to the serial monitor arduino
- Category
- C++
- Title
- length of string c++
- Category
- C++