$ ./guess_the_languageProgramming Languages
Programming Languages · hard · #611

Which programming language is this?

int process(size_t n) {
    int rc = -1;
    char *buf = malloc(n);
    if (!buf) goto out;
    memset(buf, 'x', n);
    rc = buf[0];
    free(buf);
out:
    return rc;
}

Answer: C

Assigning malloc(n) straight to a char * without a cast (an error in C++) plus a goto out; cleanup label marks this as C.
Play Programming Languages ▸