C++ Pointer Output a character array to standard output

Description

C++ Pointer Output a character array to standard output

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

void displayCharArray(char charArray[], int sizeOfArray);

int main(int nNumberofArgs, char* pszArgs[])
{
    char charArray[]={'a', 'b', 'c', 'd', 'e', 'f', 'g'};
    displayCharArray(charArray, 7);/*from  ww  w .  j  a v  a2 s  .  c o m*/
    cout << endl;

    return 0;
}

void displayCharArray(char charArray[], int sizeOfArray){
    for(int i = 0; i< sizeOfArray; i++){
        cout << charArray[i];
    }
}



PreviousNext

Related