this is my first time here asking a questions, so bear with me! I have a steganography lab that I am nearly complete with. I have completed a program that hides a message in the lower bits of an image, but the program to extract the image is where I am stuck. The image is in a file represented as a 2D matrix, column major order. So here is the code where I am stuck.

```
void image::reveal_message()
{
    int bitcount = 0;
    char c;
    char *msg;
    while(c != '\0' || bitcount < 1128)
    {
        for(int z = 0; z < cols; z++)
        {
            for(int k = 0; k < 8; k++)
            {
                int i = bitcount % rows ;
                int j = bitcount / rows ;
                int b = c & 1;
                if(img[i][j] % 2 != 0 && b == 0)
                {
                    c = c & (~1);
                }
                else if(img[i][j] % 2 == 0 && b == 1)
                {
                    c = c | 1;
                }
                bitcount++;
                c = c << 1;
            }
            reverse_bits(c);
            cout << c << endl;
            //strncat(msg, &c, 1);
        }
    }
    int i = 0;
    for(int i = 0; i < cols; i++)
    {
        if(!isprint(msg[i]))
        {
            cout << "There is no hidden message" << endl;
        }
    }
    cout << "This is the hidden message" << endl;
    cout << msg;
}

```

The code is able to loop through and grab all the right number for the bits. The bits are based on if the number in the matrix is odd or even. Where I am having trouble is actually setting the bits of the char to the bits the I extracted from the matrix. I am not the best at bit-wise operations, and we are also not supposed to use any library for this. The reverse\_bits function works as well, so it seems to be just my shifting and bit-wise operations are messed up.I also commented out the strcat() line because it was producing a lot of errors due to the fact that char c is incorrect. Also the main error I keep receiving is Segmentation Dump.