You have mixed them a little in your head but we are here. :)
Firstly, the line
doesn't get a pixel, it just declares a variable, of type RGBTRIPLE with the name triple. It would be the same as
nothing less, nothing more.
All the information, is passed to triple, through fread().
fread() takes 4 arguments:
buffer - ...
If you take a look in bmp.h, which is included as a header file to copy.c, you'll see a definition for structures named RGBTRIPLE:
So a triple has 3 variables in it of type BYTE. BYTE is defined in the header of the same bmp.h:
The missing part of Dr.Queso's response is this. A pixel is made of 3 parts - one red, one green and one blue. Each of these is represented by a number that determines it's intensity. The range for each color part of a pixel runs from 0 to 255, with 0 being the absence of that color and 255 being the maximum. Of course, that's in base 10. In hexadecimal, ...
You seem to be confused about malloc(). malloc allocates memory from heap. You can store anything inside this allotted memory location.
Specifically it expects the following input: number of bytes of memory you want to be allocated.
ptr = malloc(sizeof(int));
*ptr = 300;
printf("Address of ptr: %p\n", ptr);
printf("Value inside ptr: %...
When a struct is stored in memory, the data for each struct element is stored in sequence. That means that when a struct's data is read, the data is simply read into each element in the same order that it was stored. Individual elements can be selected out by reading them from their position in the struct. It's all about the location of each element in the ...