Created
December 27, 2011 14:32
-
-
Save thetekst/1523820 to your computer and use it in GitHub Desktop.
Shift operators (-r -c -e -d -a)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shift operators (-r -c -e -d -a) | |
#include <stdio.h> | |
int main(void) { | |
unsigned char used=0; | |
unsigned char bRead=1; | |
unsigned char bCreate=1; | |
unsigned char bEdit=1; | |
unsigned char bDelete=1; | |
unsigned char bAll=1; | |
bRead <<= 0; | |
bCreate <<= 1; | |
bEdit <<= 2; | |
bDelete <<= 3; | |
bAll = bRead | bCreate | bEdit | bDelete; | |
used = bRead | bDelete; | |
if(used & (bRead & bDelete)) printf("Есть право на доступ"); | |
else{printf("нет прав доступа");} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment