This question already has answers here:
Passing a 2D array to a C++ function
(17 answers)
How to pass a 3D array as a parameter to function C++? Also Do global variables need to be passed into functions?
(3 answers)
Passing 3D array as parameter to a function in C
(1 answer)
Closed 8 months ago.
We can send a simple array with no information about its size , but in matrixes we have to define number of raw , how about in multidimension array (more than 2 dimension) ?
void f1( int a[][][3]);
is it true ? or I have to define second dimension ?
This question already has answers here:
C++ array[index] vs index[array] [duplicate]
(4 answers)
is int[pointer-to-array] in the C++ - standard? [duplicate]
(3 answers)
Closed 2 years ago.
int a[5]={1,2,3,4,5};
int*p=a;
cout<<4[p];
return 0;
can anyone please tell me how it is giving output 5. i know it is 5 because it is the 4th element in the array. but why is 4[p] giving the output!
This question already has answers here:
What happens when I print an uninitialized variable in C++? [duplicate]
(4 answers)
Uninitialized variable behaviour in C++
(4 answers)
Is uninitialized local variable the fastest random number generator?
(22 answers)
Why do I see strange values when I print uninitialized variables?
(6 answers)
Closed 3 years ago.
If not declare value in an array, then what value hold on the memory address.
Where did these outputs come from?
int main()
{
int a[10];
cout<<a[2]<<endl;
cout<<a[2]<<endl;
cout<<a[3]<<endl;
cout<<a[3]<<endl;
return 0;
}
//Given Output
//1978190368
//1978190368
//1129149863
//1129149863
This question already has answers here:
C++11: Correct std::array initialization?
(5 answers)
Why can't simple initialize (with braces) 2D std::array? [duplicate]
(1 answer)
Closed 5 years ago.
I am early in c++. I want to define an 3d std::array in c++. when i define bellow array:
std::array<std::array<std::array<double,3>,4>, 4> DownSide = {
{{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35}},
{{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35}},
{{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35}},
{{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35},{0,0.51,0.35}}
};
I see this error:
error: too many initializers for ‘std::array<std::array<std::array<double, 3ul>, 4ul>, 4ul>’
};
I googled this error find i mistak in numer brackets, but i dont know and find how must i write them.
How must i do?
This question already has answers here:
How do I use arrays in C++?
(5 answers)
Closed 10 years ago.
In C++, is it possible to give array as input to a function.
Most likely you can do this all with vectors.
#include <vector>
std::vector<int> function_name(const std::vector<int>& A, const std::vector<int>& B);