I'm trying to teach myself C via the iTunes University/Harvard CS50 course. In it a program is to be written which resizes a bitmap image file. To do this, I've defined an array (buffer) and written the necessary code for the program to work - it does work. However, I had to cheat and Google an answer as I couldn't figure it out, and I don't understand a particular piece of syntax in the solution and am hoping someone can help.
The block of code looks like the below and I've put in the comments my specific point of confusion:
// allocate array to hold scanline pixels - this is the array I define
RGBTRIPLE *buffer = malloc(bi.biWidth * sizeof(RGBTRIPLE));
// declare variable to track position in buffer array
int count;
// iterate over infile's scanlines
for (int i = 0, height = abs(oldHeight); i < height; i++)
{
// initialize count var to 0
count = 0;
// iterate over pixels in scanline
for (int j = 0; j < oldWidth; j++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// place pixel in buffer array n times
for (int k = 0; k < n; k++)
{
// below is the confusion. Some sudo code would be great!
*(buffer+(count)) = triple;
count++;
}
}
sudo. The word you are looking for is "pseudo code".