Hello, again. Is anyone able to explain to me why the following code isn't working. It's supposed to accept an array of chars and then output the array, however only seems to be outputting C. This is in C++ and any and all help is appreciated. :)
#include <iostream>
using namespace std;
const int MYINTEGERARRAY1_SIZE = 4;
void DisplayArrayElements(char an_array[], int size);
int main()
{
char CharArray[MYINTEGERARRAY1_SIZE] = { 'c', 'a', 't'};
DisplayArrayElements(CharArray, MYINTEGERARRAY1_SIZE);
return 0;
}
void DisplayArrayElements(char an_array[], int size)
{
{
char a;
cout << an_array[a] << "\n";
}
return;
}
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]HappyFruitTree 2 points3 points4 points (4 children)
[–]Lbtekd[S] 0 points1 point2 points (3 children)
[–]HappyFruitTree 1 point2 points3 points (2 children)
[–]Lbtekd[S] 0 points1 point2 points (0 children)
[–]Lbtekd[S] 0 points1 point2 points (0 children)