I have a piece of code like this (Perl file):
print "9 + 16 = ", add(9, 16), "\n";
print "9 - 16 = ", subtract(9, 16), "\n";
C code also,
#include<stdio.h>
main ()
{
int x = 9;
int y = 16;
printf(" add() is %d\n", add(x,y));
printf(" sub() is %d\n", subtract(x,y));
// return 0;
}
int add(int x, int y)
{
return x + y;
}
int subtract(int x, int y)
{
return x - y;
}
How can I run this C code with perl using Inline::C? I tried but i am not exactly getting.
Inline::C-Cookbook - A Cornucopia of Inline C Recipes, you
will get lot of examples using Inline
with C.Inline - Write Perl subroutines in other programming languages, you will come to know how to use Inline and you will get C examples too.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With