c++ - How to declare the Char array of char variables already declared in class? -
#include <stdio.h> #include <iostream> using namespace std; //char* b[6] = new char[6]; char a[6] = {'b','c','d','e','f','g'}; char c[6] = {'a','b','d','d','f','g'}; int main() { char d[][6]={*a,*c}; (int x = 0 ; x < 1; x++) { for(int y = 0; y<6; y++) { char test = d[x][y]; cout << test <<"\n"; } } return 0; }
this code c++ code. trying create class stores char array. there char array of array storing declared char variables. compiles fine doesn't work out should. doesn't me right value should when program tries print value
may meant array of pointers:
char *d[]={a,c};
Comments
Post a Comment