Here is a little example I made of running C terminal code on glitch.
Step one: Set up your C code.
#include<stdio.h>
int main(void) {
printf("Hello World\n");
return 0;
}
Name the file something like “test.c”. You will want to save it in a project the runs php such as lamp-poc.
Step Two: PHP
exec()
in php runs code in the shell.
Compile the C and save it to “test”. (This assumes you are using the Linux terminal with gcc installed)
exec("gcc test.c -o test");
Run it and echo the result.
echo exec("./test");
And thats it! Thank you for reading. A full example can be seen here.