New answers tagged

1

Both name and number are declared as char * (ie, a pointer variable). Pointers hold addresses and the sizeof(char*) is 8 bytes in a 64-bit system like the CS50 IDE. So people will have a size of 16 bytes, as you're seeing in your print statements. What name and number actually point to is irrelevant to the size of the pointer itself. The memory for the ...


1

The code knows how long each structure element is, thanks to the definition in the header file, so it only needs to add the appropriate number of bytes to the starting address to get to anything. The elements are sequentially ordered, and that order never changes, nor are any other data fields placed in the sequence. For example, BITMAPINFOHEADER.biPlanes is ...


0

Think carefully about the values being used. Let's start with the first pixel, at 0,0, and that the image is 3x3 pixels. image[a][b].rgbtRed = image[a][width - b].rgbtRed; Fill in the numbers for the first pixel being processed in the first pass of the loop. image[0][0].rgbtRed = image[0][3 - 0].rgbtRed; This becomes: image[0][0].rgbtRed = image[0][3]....


Top 50 recent answers are included