LogiQuest
Back to Memory Allocation
2

What will be the output of the program?

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

int main(void) {
    int *p = calloc(4, sizeof(int));
    if (!p) return 1;
    printf("%d %d\n", p[0], p[3]);
    free(p);
    return 0;
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.