Pergunta de entrevista da empresa Lutron Electronics

What will the following code print out on the terminal? int main(){ int a = 5; foo(a); printf("%d",a); } void foo(int a){ int* ptr = &a; *a = 10; }

Resposta da entrevista

Sigiloso

23 de fev. de 2024

foo() is pass by value, so the variable "a" never gets changed, making the terminal print "5".