1. Home
  2. /
  3. Emscripten
  4. /
  5. Maximum of Two Numbers (Emscripten)

Maximum of Two Numbers (Emscripten) - Emscripten Typing CST Test

Loading…

Maximum of Two Numbers (Emscripten) — Emscripten Code

Returns the maximum of two integers.

# emscripten/demo/max.c
#include <emscripten/emscripten.h>

EMSCRIPTEN_KEEPALIVE
int max(int a, int b) {
	return a > b ? a : b;
}

Emscripten Language Guide

Emscripten is an open-source compiler toolchain that compiles C and C++ code into WebAssembly (Wasm) or asm.js, allowing developers to run native code in web browsers at near-native speed.

Primary Use Cases

  • ▸Porting desktop games and engines to web browsers
  • ▸Running scientific simulations and numerical computing in browsers
  • ▸Enabling multimedia processing (audio/video) on the web
  • ▸Creating WebAssembly modules for high-performance web apps
  • ▸Bridging native code libraries to JavaScript/TypeScript projects

Notable Features

  • ▸Compiles C/C++ code to WebAssembly and asm.js
  • ▸Supports modern web APIs like WebGL and WebAudio
  • ▸Provides a virtual file system (MEMFS, IDBFS)
  • ▸Enables multi-threaded code via WebAssembly threads
  • ▸Integrates with JavaScript using embind or WebIDL bindings

Origin & Creator

Emscripten was originally developed by Alon Zakai in 2010 and is now maintained as an open-source project under the LLVM and WebAssembly ecosystems.

Industrial Note

Emscripten is ideal for developers porting legacy C/C++ applications to the web, including games, scientific simulations, multimedia apps, and performance-critical software.

More Emscripten Typing Exercises

Simple C Addition Function (Emscripten)Subtract Two Numbers (Emscripten)Multiply Two Numbers (Emscripten)Divide Two Numbers (Emscripten)Factorial Function (Emscripten)Fibonacci Function (Emscripten)Check Even Number (Emscripten)Check Odd Number (Emscripten)Minimum of Two Numbers (Emscripten)

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher