imports the printf function
using System;
using System.Runtime.InteropServices;
public class Starter {
public static void Main() {
int val1 = 5, val2 = 10;
API.printf("%d+%d=%d", val1, val2, val1 + val2);
}
}
public class API {
[DllImport("msvcrt.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int printf(string formatspecifier, int lhs, int rhs, int total);
}
Related examples in the same category