C++ examples for Data Type:char
Output a character array to standard output by using ending character
#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; void displayString(char stringArray[]); int main(int nNumberofArgs, char* pszArgs[]){ char charArray[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', '\0'}; //from w w w . jav a2 s.c o m displayString(charArray); cout << endl; return 0; } void displayString(char stringArray[]){ for(int i = 0; stringArray[i] != '\0'; i++){ cout << stringArray[i]; } }