بیت فیلد: تفاوت میان نسخهها
محتوای حذفشده محتوای افزودهشده
اصلاح رده |
←زبان برنامهنویسی سی: ترجمه کامنتها به فارسی |
||
خط ۱۵:
تعریف یک بیت فیلد در زبان سی
<source lang="c">
//
#define YES 1
#define NO 0
// سبک خطها
#define SOLID 1
#define DOTTED 2
#define DASHED 3
// رنگهای اولیه
#define BLUE 4 /* 100 */
#define GREEN 2 /* 010 */
#define RED 1 /* 001 */
// رنگهای مخلوط
#define BLACK 0 /* 000 */
#define YELLOW (RED | GREEN) /* 011 */
خط ۳۸:
const char * colors[8] = {"Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White"};
// مشخصات جعبه بیت فیلد
struct box_props
{
unsigned int opaque : 1;
unsigned int fill_color : 3;
unsigned int : 4; //
unsigned int show_border : 1;
unsigned int border_color : 3;
unsigned int border_style : 2;
unsigned char : 0; //
unsigned char width : 4, //
height : 4;
};
</source>
== منابع ==
{{پانویس}}
|