pub struct Slice<T> {
ptr: *const T,
len: usize,
}
I changed to this btwpub struct Slice<T> {
ptr: *const T,
len: usize,
}
I changed to this btw &[T]
directly? ^^&[T]
directly? ^^ extern
fn uses type [macros::macros::Token]
, which is not FFI-safe
consider using a raw pointer instead
slices have no C equivalent#[repr(C)]
#include <iostream>
int main() {
int x = 10;
int y = 3;
int z = x / y;
std::cout << z << std::endl;
return 0;
}
#include <iostream>
int main() {
int x = 10;
int y = 3;
int z = x / y;
std::cout << z << std::endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
double sales = 95000;
cout << "Sales: $" << sales << endl;
double stateTax = sales / .04;
cout << "State Tax: $" << stateTax << endl;
double countyTax = sales / .02;
cout << "County Tax: $" << countyTax << endl;
return 0;
}
std::format("State Tax: {:.2f}", stateTax)
(edited)