LogiQuest
Back to Memory Allocation
12

What will be the output of the program?

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

int main(void) {
    double *d = calloc(3, sizeof(double));
    if (!d) return 1;
    printf("%.1f\n", d[0] + d[1] + d[2]);
    free(d);
    return 0;
}
Easy

Discussion (0)

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

Log in to join the discussion.