myarray output is not number why

#include<iostream>
#include<cstring>

using namespace std;

void printarray(int arg[], int length);//function declararion
void printchar(char arg[], int length);//func declaration
int main(){
int myarray[] = {2,10,3};
char mychar[] = {'H','e','l','l','o','\0'};

printarray(myarray,3);//func call

cout << "myarray:" << myarray << endl;//the result is other kind of number.
system("PAUSE");

printchar(mychar,5);//func call//5 or 6 is the same result
cout << "mychar:" << mychar << endl;//the result is same character.
system("PAUSE");
}
char arrays are handled differently because they are often used to store strings. If you try to print other types of arrays the same way it prints the memory address of the array instead.
Topic archived. No new replies allowed.