Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bitex
//gcc 7.4.0 //Bitex: bit field example //this code is created by Rezaul Hoque on April 01,2022;contact: jewelmrh@yahoo.com,Dhaka, Bangladesh //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <stdio.h> struct bitex{ unsigned int a:3; unsigned int b:3; unsigned int c: 1; unsigned d:1; unsigned e:1; }; void display(struct bitex); void display(struct bitex bit){ printf("a: %d\n",bit.a); printf("b: %d\n",bit.b); printf("c: %d\n",bit.c); if(bit.d) printf("d is assigned a nonzero value.\n"); else printf("d is assigned zero.\n"); if(bit.e) printf("e is assigned a nonzero value.\n"); else printf("e is assigned zero.\n"); } int main(void) { struct bitex bit; bit.a=3; bit.b=2; bit.c=1; bit.d=1; bit.e=0; display(bit); return 0; }
run
|
edit
|
history
|
help
0
A141107_Potencia
B_141121_factorial02
Project 5 v.08
Project v0.07
Lab 11
KN king Array ques
C_141211_OrdenarArrayConFunciones
readability!
Area of a rectangular prism
Simple interest