Write a C program that stores information about the state of 32 different leds.
ID: 654222 • Letter: W
Question
Write a C program that stores information about the state of 32 different leds. An led will either be on (1) or off (0). You want to minimize the amount of memory needed to store this information. Use a data type of uint_32t, defined in stdint.h to store the led states. Initialize all leds to off. Allow the user to choose from setting led state for any of the 32 leds or querying the state of an led. You will only need 1 variable to store this information. Use bit operations to set and read state values.
Explanation / Answer
include<stdio.h>
int main(){
FILE *fp;
char ch;
fp=fopen("file.txt","w");
printf("Enter data for led :");
while((ch=getchar())!=EOF)
putc(ch,fp);
fclose(fp);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.