script in c code example

Example 1: script in c

#!/usr/bin/perl
use Inline C;
$arg = $ARGV[0];
$arg = tr/[a-z]/[A-Z]/; # modification du paramètre
exit main0($arg);
__END__
__C__
#include <stdio.h>

int main0(char *arg1)
{
   printf("Hello %s \n",arg1);
   return 0;
}

Example 2: script in c

$ chmod +x test1.c
$ ./test1.c
> Hello world !

Example 3: script in c

#!/usr/bin/perl
use Inline C;
exit main0();
__END__
__C__
#include <stdio.h>

int main0()
{
   printf("Hello world !\n");
   return 0;
}

Tags:

C Example