10

You have mixed them a little in your head but we are here. :) Firstly, the line RGBTRIPLE triple; doesn't get a pixel, it just declares a variable, of type RGBTRIPLE with the name triple. It would be the same as int count; nothing less, nothing more. All the information, is passed to triple, through fread(). fread() takes 4 arguments: buffer - ...


5

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: typedef struct { BYTE rgbtBlue; BYTE rgbtGreen; BYTE rgbtRed; } __attribute__((__packed__)) RGBTRIPLE; So a triple has 3 variables in it of type BYTE. BYTE is defined in the header of the same bmp.h: #include &...


2

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, ...


1

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. int *ptr; ptr = malloc(sizeof(int)); *ptr = 300; printf("Address of ptr: %p\n", ptr); printf("Value inside ptr: %...


1

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible