baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
This code is obviously wrong. So, again, how do i do this ????use strict; my @v = (1,2,3,4); my $r = rain(\@v); print "$r\n"; use Inline C => <<'CC'; int rain(AV *a){ Inline_Stack_Vars; int i; for (i = 0; i < Inline_Stack_Items; i++) printf("%d\n",Inline_Stack_Item(i)); } Inline_Stack_Void; return 5; } CC
Thnx
Update:
also is it possible to omit this "Inline_Stack_Vars" and just use "a" as an array reference:
Update:int rain(AV *a,int n){ // where n is the size of the array int i; for (i = 0; i < n; i++) printf("%d\n",a[i]); } return 5; }
yeap, ok, never mind, i was confused vith SV* and AV*
++ moritz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: InlineC problem
by moritz (Cardinal) on Oct 07, 2011 at 10:34 UTC |