Skip to content

Instantly share code, notes, and snippets.

@NeoCat
Created August 9, 2018 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeoCat/cf4b2eb6cc460875af3fe2b8cf630174 to your computer and use it in GitHub Desktop.
Save NeoCat/cf4b2eb6cc460875af3fe2b8cf630174 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
double a, b, c;
void test(int sig)
{
printf("%f\n", a * b + c);
}
int main(int argc, char *argv[])
{
a = argc;
b = atof(argv[1]);
c = atof(argv[2]);
signal(SIGUSR1, test);
for (int i = 1; i <= 1000; i++) {
printf("%f %f %f\n", a, b, c);
a += 1;
b *= i;
b -= 1;
sleep(1);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment