Pergunta de entrevista da empresa 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; }

Respostas da entrevista

Sigiloso

6 de mai. de 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

Sigiloso

28 de abr. de 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