Pregunta de entrevista de NVIDIA

What is the problem with the following code. __interrupt double compute_area(double radius) { { double area = PI * radius * radius; printf(“\nArea = %f”, area); return area; }

Respuestas de entrevistas

Anónimo

6 may 2018

printf is a blocking routine. It **must** not be used in an ISR. Consider the case then an interrupt arrived and this ISR is invoked and stdout is blocked by some other task. This code will give you nightmare bugs which are almost impossible to debug

Anónimo

28 abr 2016

How will you declare the following: (a) A pointer to an integer: (b) A pointer to a pointer to an integer: (c) An array of ten integers: (d) An array of ten pointers to integers: (e) A pointer to an array of ten integers (f) A pointer to a function that takes an integer as an argument and returns an integer

5