Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C problem

Name: Anonymous 2012-01-18 19:35

Is the behaviour of this program well defined?

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

int main() {
    size_t num, min, max;
    if(scanf("%zu%zu%zu", &num, &min, &max) != 3) return 0;
    if(min >= num || max >= num || min > max) return 0;
    int *arr = calloc(num, sizeof(*arr));
    if(!arr) return 0;
    int *x = arr + min, *y = arr + max, *z = arr + (y - x);
    *x = 1, *y = 1, *z = 1;
    return 0;
}

Name: Anonymous 2012-01-22 14:20

>>59
Whatever, as long as you fuck off.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List