Since C++11, you can copy arrays directly with std::array
:
std::array<int,4> A = {10,20,30,40}; std::array<int,4> B = A; //copy array A into array B
Here is the documentation about std::array
Related Posts:
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- C++ array assign error: invalid array assignment
- Double pointer array in c++
- Warning: comparison of distinct pointer types
- What is a segmentation fault?
- How many spaces for tab character(\t)?
- How to dynamically allocate arrays in C++
- What does (~0L) mean?
- How to dynamically allocate arrays in C++
- What is the difference between float and double?
- How do I find the length of an array?
- What is the effect of extern “C” in C++?
- Why are #ifndef and #define used in C++ header files?
- What exactly is the difference between “pass by reference” in C and in C++?
- When to use extern “C” in simple words? [duplicate]
- Floating point exception( core dump
- Initializing an array of objects
- Passing an array by reference
- Return array in a function
- Mutex example / tutorial? [closed]
- What does “dereferencing” a pointer mean?
- What is an unsigned char?
- What does “dereferencing” a pointer mean?
- Passing an array by reference
- Convert char to int in C and C++
- Why use conio.h?
- How to convert a char array to a string?
- What is the array form of ‘delete’?
- How to track down a “double free or corruption” error
- Convert an int to ASCII character
- Use new operator to initialise an array
- How to track down a “double free or corruption” error
- Why unsigned int 0xFFFFFFFF is equal to int -1?
- What is the significance of return 0 in C and C++?
- How do I declare a 2d array in C++ using new?
- How to go from fopen to fopen_s
- Difference between long double and double in C and C++ [duplicate]
- What is use of c_str function In c++
- lvalue required as left operand of assignment – Array
- What is the difference between const int*, const int * const, and int const *?
- What is the C version of RMI
- How to print pthread_t
- What is the difference between const int*, const int * const, and int const *?
- What is the printf format specifier for bool?
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Cleanest way to copy a constant size array in c++11
- Difference between using Makefile and CMake to compile the code
- Reverse Contents in Array
- C++ error: “Array must be initialized with a brace enclosed initializer”
- What is the difference between a static and const variable?
- Should I learn C before learning C++?
- warning: ISO C++ forbids variable length array
- Eclipse C++ : “Program “g++” not found in PATH”
- c++ array – expression must have a constant value
- Visual Studio debugger error: Unable to start program Specified file cannot be found
- Passing a 2D array to a C++ function
- unsigned int vs. size_t
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- Convert Python program to C/C++ code?
- error: expected primary-expression before ‘)’ token (C)
- Is “argv[0] = name-of-executable” an accepted standard or just a common convention?
- Examples of good gotos in C or C++
- What is activation record in the context of C and C++?
- Static array vs. dynamic array in C++
- How to create a dynamically-allocated array of const objects, but have values assigned to them?
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Fill array with random numbers within a specified range (C++)
- How to convert C++ Code to C
- Remove an array element and shift the remaining ones
- How to add element to C++ array?
- How to convert vector to array
- Fatal error: ‘stdafx.h’ file not found
- warning: control reaches end of non-void function [-Wreturn-type]
- How to find the size of an int[]?
- C++: Expression must have a constant value when declaring array inside function
- gcc/g++: “No such file or directory”
- splitting a string into an array in C++ without using vector
- What’s the syntax for declaring an array of function pointers without using a separate typedef?
- What does ‘const static’ mean in C and C++?
- How to use glOrtho() in OpenGL?
- Printing an array in C++?
- Delete 2D array C++
- Best C/C++ Network Library
- Is the sizeof(some pointer) always equal to four?
- 2D array vs array of arrays
- How do you initialise a dynamic array in C++?
- How do malloc() and free() work?
- How to run valgrind with basic c example?
- Typedef function pointer?
- “…redeclared as different kind of symbol”?
- What is the use of intptr_t?
- How to add element to C++ array?
- Reading from .txt file into two dimensional array in c++
- Debug vs Release in CMake
- How can I get the list of files in a directory using C or C++?
- Debug vs Release in CMake
- How can I get the list of files in a directory using C or C++?
- What does “Permission denied” “Id returned 1 exit status” mean?
- extended initializer lists only available with
- Multi-character constant warnings