What will be printed out as a result of the following code execution?

#include "stdio.h"

int main() {
    int * var = new int(2);
    *var*=2;
    printf("%d", *var);
    return 0;
}
Explanation
Pointers are used here, var is a pointer to an integer that is accessed with *var. In the first line *var is initialized with 2. Second line is equal to *var = (*var) * 2

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести