Question: Please tell me how to make this code below work on onlinegdb.com, I can not get this c code to show the 0 s and

Please tell me how to make this code below work on onlinegdb.com, I can not get this c code to show the 0s and 1s, the only output i get is usage.a.out speed.Please show screenshots of how to exactly get this code to work or show a screenshot of the output you get using onlinegdb.com!
code:
#include
#include
#include
#include
#include
// Signal handler for Ctrl-C
void handle_sigint(int sig){
endwin();
exit(0);
}
int main(int argc, char *argv[]){
if (argc !=2){
printf("Usage: %s speed
", argv[0]);
return 1;
}
int speed = atoi(argv[1]);
if (speed 1|| speed >99){
printf("Speed must be between 1 and 99.
");
return 1;
}
// Initialize curses
initscr();
cbreak();
noecho();
curs_set(0);
timeout(100- speed); // Adjust speed
srand(time(NULL)); // Seed the random number generator
// Set up signal handler for Ctrl-C
signal(SIGINT, handle_sigint);
int max_x, max_y;
getmaxyx(stdscr, max_y, max_x);
while (1){
for (int x =0; x max_x; x++){
int r = rand()%3;
char ch =(r ==0)?'0' : (r ==1)?'1' : '';
mvaddch(0, x, ch);
}
scrollok(stdscr, TRUE);
scrl(1);
refresh();
}
// End curses mode
endwin();
return 0;
}
 Please tell me how to make this code below work on

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!