mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
docs: call_v_from_c example (#15844)
This commit is contained in:
parent
7f23abbf8c
commit
50820105a1
8 changed files with 95 additions and 1 deletions
14
examples/call_v_from_c/test_math.c
Normal file
14
examples/call_v_from_c/test_math.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern int square(int i);
|
||||
|
||||
extern double sqrt_of_sum_of_squares(double x, double y);
|
||||
|
||||
int main()
|
||||
{
|
||||
int i = 10;
|
||||
printf("square(%d) = %d\n", i, square(i));
|
||||
double x=0.9;
|
||||
double y=1.2;
|
||||
printf("sqrt_of_sum_of_squares(%f, %f) = %f\n", x, y, sqrt_of_sum_of_squares(x, y));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue