I am working on resize.c, and I was wondering why when you set the new dimensions for the bitmap, the width and height in the code are written as bi.biWidth and bi.biHeight. i.e. why do you write:

(int original_width = bi.biWidth;) instead of (int original_width = biWidth;)

I am confused because in the information under BITMAPINFOHEADER the width and height are just called biWidth and biHeight respectively. What is the purpose of having the bi. added to biWidth and biHeight when they are used in the code?


Welcome to the wonderful world of structures! ;-)

A structure, or a struct, is a collection of individual vars combined into a group. The group has a variable name, and each element in the struct has a name. To access a particular element in a struct, you access it by structure and element name. Remember that the element names in all structs of the same type follow the same structure.

The format is struct_name.element_name. The var name befor the dot is the structure variable name, and the var name following the dot is the particular element name.

So, to answer your question, 'bi' is the name of a struct variable. 'biWidth' is the name of one of several elements in that struct. Combine them together with a dot between them and you get a unique element in a unique struct.

You could have two structs, bi1 and bi2. bi1.biWidth and bi2.biWidth have no relation to each other, except that they will be of the same type, thanks to the struct definition.

For more, consult the class materials. ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • Thank you for the explanation :) It helped clarify things up. – clouding_980 Jan 23 '17 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .