Learn C and C++ on iPad

Practice C and C++ on iPad by writing a small program, compiling it with Kodo and comparing the terminal output against your expected result.

Download Kodo on the App Store

By Theodor Tiberius StefanUpdated

How to get started

  1. Create a project folder for the week and keep an untouched copy of the assignment instructions.
  2. Create main.c and paste the example below. Run it and check that it prints 12.
  3. Change the loop to start at zero. Predict the new value before you check the output.
  4. Try rewriting the same program in main.cpp using a function. Compare the two results with the same inputs.
  5. Check your code with the course’s exact compiler and settings before submitting.
#include <stdio.h>

int main(void) {
    int sum = 0;
    for (int i = 1; i <= 3; ++i) {
        sum += 2 * i;
    }
    printf("%d\n", sum);
    return 0;
}

Limits to know

Kodo’s bundled toolchain targets C11 and C++17. Plan a remote workflow if the course requires a different language standard, native libraries or desktop tooling.

Frequently asked questions

Can I work on the train without Wi-Fi?

Yes. Save the source files locally before leaving. [source: App Store]

How do I see a compiler error?

Run the file and read the diagnostics in the terminal. Fix the first reported line and compile again.

Can I use my university compiler?

Use SSH to the authorised lab environment if your university provides access.

Where should I keep examples?

Use one local project for each assignment and name the entry file clearly.

Related guides

Download Kodo on the App Store Read the Kodo guide

App Store release 5.6 ·