passing array to function in c++
C++
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;
}void myFunction(int param[]) {
.
.
.
}
Also in C++:
- Title
- sort function in cpp
- Category
- C++
- Title
- body parser
- Category
- C++
- Title
- c++ transform
- Category
- C++
- Title
- c++ delet from memory
- Category
- C++
- Title
- loop c++
- Category
- C++
- Title
- iostream library in cpp
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- making random numbers in c++
- Category
- C++
- Title
- check for bst
- Category
- C++
- Title
- how to find the index of an element in a vector c++
- Category
- C++
- Title
- c++ typeid get type name
- Category
- C++
- Title
- multiple words C++ in same
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- Insert into vector C++
- Category
- C++
- Title
- flake8 max line length
- Category
- C++
- Title
- c++ show time elapsed
- Category
- C++
- Title
- inheritance protected in c++
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- traverse a map
- Category
- C++
- Title
- case label in c++
- Category
- C++
- Title
- cout value c++
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- how to declare a function in c++
- Category
- C++
- Title
- c++ switch case statement
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- range based for loop c++ with reference
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- c++ set add element
- Category
- C++
- Title
- range based for loop c++
- Category
- C++
- Title
- how to decalre a string in c++
- Category
- C++
- Title
- static variable in c++
- Category
- C++
- Title
- is x prime?
- Category
- C++
- Title
- min coin change problem dp
- Category
- C++
- Title
- power in c++
- Category
- C++
- Title
- first prime numbers
- Category
- C++
- Title
- opperanf >> c++
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- c++ argv
- Category
- C++
- Title
- Given an undirected graph, count the number of connected components.
- Category
- C++
- Title
- & in xml
- Category
- C++
- Title
- Html tab
- Category
- C++
- Title
- calling by reference and pointers c++
- Category
- C++
- Title
- Application of c++ in youtube program
- Category
- C++
- Title
- single line if c++
- Category
- C++
- Title
- C++ user input
- Category
- C++
- Title
- map vs unordered_map in C++
- Category
- C++
- Title
- how to output text in c++
- Category
- C++
- Title
- subarray sum in c++
- Category
- C++
- Title
- c++ clear console
- Category
- C++
- Title
- what is difffrence between s.length() and s.size()
- Category
- C++
- Title
- new in c++
- Category
- C++
- Title
- c++ write string
- Category
- C++
- Title
- Rectangle area hackerrank solution in c++
- Category
- C++
- Title
- empty string c++ value
- Category
- C++
- Title
- how to type cast quotient of two integers to double with c++
- Category
- C++
- Title
- cin.fail()
- Category
- C++
- Title
- phph date
- Category
- C++
- Title
- variadic templates
- Category
- C++
- Title
- clear console c++
- Category
- C++
- Title
- removing repeated characters in a string c++
- Category
- C++
- Title
- preorder traversal
- Category
- C++
- Title
- syntax c++
- Category
- C++
- Title
- c++ loop through array
- Category
- C++
- Title
- how to create a vector in c++
- Category
- C++
- Title
- how to print for limited decimal values in c++
- Category
- C++
- Title
- c++ char print fixed
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- leveling system c++
- Category
- C++
- Title
- capitalize first letter c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- find in set of pairs using first value cpp
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- binary tree deletion
- Category
- C++
- Title
- least number of coins to form a sum
- Category
- C++
- Title
- initialize int c++
- Category
- C++
- Title
- what is time complexity of min_element()
- Category
- C++
- Title
- advanced c++ topics
- Category
- C++
- Title
- compile c++ linux
- Category
- C++
- Title
- how to ensure the user inouts a int and not anything else c++
- Category
- C++
- Title
- c++ how to skip the last element of vector
- Category
- C++
- Title
- cpp pi from acos
- Category
- C++
- Title
- c++ for loop
- Category
- C++
- Title
- c++ std::copy to cout
- Category
- C++
- Title
- c++ client service ros
- Category
- C++
- Title
- cpp nan value
- Category
- C++
- Title
- filling 2d array with 0 c++
- Category
- C++
- Title
- coping 2d vector in cpp
- Category
- C++
- Title
- popualte an array c++
- Category
- C++
- Title
- c++ do while loop
- Category
- C++
- Title
- c++ string to integer without stoi
- Category
- C++
- Title
- what is order in of preeendence in float, int, char, bool
- Category
- C++
- Title
- if esle in c++
- Category
- C++
- Title
- matrix eigen c++ example
- Category
- C++
- Title
- centos7 mlock2
- Category
- C++
- Title
- memcmp in cpp
- Category
- C++
- Title
- how to find length of string in c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- variabili in c++
- Category
- C++
- Title
- c++ delete printed characters
- Category
- C++
- Title
- transpose matrix eigen c++
- Category
- C++