Complete the declaration and initialization of the array variable with datatype character, char array[ ]=???;. Initialized the first index with A, the second index with T, the third index E, the fourth index N, the fifth index as E, and the sixth index as O.
Your answer's format should be a complete declaration at the same time initialization:
format: datatype array_name[ ]=???;
Answer:
#include<iostream>
using namespace std;
int main(){
char name[6];
name[0] = 'A';
name[1] = 'T';
name[2] = 'E';
name[3] = 'N';
name[4] = 'E';
name[5] = 'O';
for(int i=0; i<6; i++){
cout<<name[i]<<" ";
}
}
Comments
Leave a comment