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
Play Programming Languages ▸
malloc(n) straight to a char * without a cast (an error in C++) plus a goto out; cleanup label marks this as C.