mirror of
https://github.com/guilhermewerner/rust-ffi
synced 2025-06-16 05:44:19 +00:00
Create C and C++ Examples
This commit is contained in:
34
Examples/C/Hello.c
Normal file
34
Examples/C/Hello.c
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#include "Library.h"
|
||||
|
||||
extern float Add(float Num1, float Num2);
|
||||
extern float Divide(float Num1, float Num2);
|
||||
extern float Multiply(float Num1, float Num2);
|
||||
extern float Subtract(float Num1, float Num2);
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Rust Calculator\n");
|
||||
|
||||
int num1 = 1;
|
||||
int num2 = 2;
|
||||
|
||||
float added = Add(num1, num2);
|
||||
float subtracted = Subtract(num1, num2);
|
||||
float multiplied = Multiply(num1, num2);
|
||||
float divided = Divide(num1, num2);
|
||||
|
||||
printf("\nAdded: %f", added);
|
||||
printf("\nSubtracted: %f", subtracted);
|
||||
printf("\nMultiplied: %f", multiplied);
|
||||
printf("\nDivided: %f", divided);
|
||||
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
|
||||
system("PAUSE");
|
||||
}
|
Reference in New Issue
Block a user