here are my codes:

#ifndef STUDENT_H
#define STUDENT_H


class student
{
    public:
        void enterDetails();
        void enterModule();
        void displayDetails();


    private:
        char name[100];
        char studID[100];
        char address[100];
        char module[100];

};


#endif 

i want to add a 2d array "M[row][col]" in my class but i don't know how to do it anyone help?

i want to add a 2d array "M[row][col]" in my class but i don't know how to do it anyone help?

whats the problem with that?
i think it would be same with class concept(i've not started yet with class concept) .
just declare variable with 2 dimension will make it 2d array.

int ar[10][10];//this is 2d array

Hi nitish.mohiputlall,
It is better if you declare pointer variables then do "dynamically allocated array".
For 1D array:

char *array
//create 1D array
array = new char[size]

//use 1D array

// delete 1D array
delete [] array

For 2D array, similarly:

//create 2D array
char **array = new *char[ROWS];
for( int i = 0; i < ROWS; i++ )
    array[i] = new char[COLS];

//use 2D array

// delete 2D array
for( int i = 0; i < ROWS; i++ )
    delete[] array[i];
delete [] array;

Somthing like that, you could google the keywords for more information. Hope it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.