LogiQuest
Back to Pointers
17

What will be the output of the program?

#include <stdio.h>

int main(void) {
    int a[3] = {1, 2, 3};
    int sum = 0, *p;
    for (p = a; p < a + 3; p++) sum += *p;
    printf("%d\n", sum);
    return 0;
}
Easy

Discussion (0)

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

Log in to join the discussion.