Be consistent. int A[10]; *or* vector A (10); Use address of first element: MPI_Send (&A[0], ...); Could even do MPI_Send (&A[4], ...); MPI_Send (A.data(), A.size(), mpiType(A), ... ) == Watch names. Make them mnemonic. vector randomNums; vector localSums; float sumOfSums; Use "my" prefix for a name that depends on the process (local). int myRank; vector myRandomNums; == Prefer vectors to arrays. Ensure vectors are sized properly. vector nums; // Bad for (size_t i = 0; i < N; ++i) // Should use push_back nums[i] = 5; vector nums (N); // Good for (size_t i = 0; i < N; ++i) nums[i] = 5; How to convert vector to array: void f (int A[], size_t len); // Call with f (&nums[0], nums.size ()); == Arrays cannot be dynamically sized. int N; cin >> N; // Error: size must be const integral type int A[N];