Question d’entretien chez Microsoft

Phone interview question: In C, why is it considered bad form for a function to return a pointer to a stack-allocated variable? What happens if you do it anyway?

Réponse à la question d'entretien

Utilisateur anonyme

5 mai 2009

Here's a hint: You can actually do this in C, and your program will work okay... for a while. The data that your pointer points to will not be corrupted until your program performs a certain action.

1