hi friends,

i am doing visual c++ course , i got a image which captured from webcam, that image to be stored in 2d array can any one help me how to store that RGB image in to an array please.

struct RGB
    int Red;
    int Green;
    int Blue;


int width,height;
RGB **data;
int bytesPerPixel = 8; //if RGB or 24 Bit image
int i,j;
int value=0;

    //constuctor declaration
    // destructor declaration
 char *ptr=(char*)(&data[0][0]);

 //function to capture image

int  Image::capture()
   int i,j;
  unsigned byte** array_2D=NULL;


    array_2D = new unsigned byte*[height];
     if(array_2D == NULL) 
        return 0; // return if memory not allocated

     for(int j=0; j<height; j++)
            array_2D[j] = new unsigned byte*[width];
            if(array_2D[j] == NULL) 
                return 0;       // return if memory not allocated

          for(j=0; j<height; j++) // traverse height (or rows)
                for(int i=0; i<width; i++) // traverse width (or columns)
                       array_2D[j][i] = value++;// update value at current (i, j)
                     value = 0;

here i want to read rgb values for the image in an array i am not getting that one. and u check the pointers in the program. thanq for replying.