C Interview Questions

5,469 c interview questions shared by candidates

1) What does the following code do? 2) What changes would you make to improve the code (not regarding performance)? void func(int array[ARRAY_SIZE]) { int p = 0; for (int r = 0; r < 4; r++) { for (int i = p; i < ARRAY_SIZE; i++) { if (array[i] % 5 == r) { if (i != p) { int temp = array[p]; array[p] = array[i]; array[i] = temp; } p++; } } } }
avatar

C++ Software Developer

Interviewed at Mobileye

3.8
Dec 31, 2024

1) What does the following code do? 2) What changes would you make to improve the code (not regarding performance)? void func(int array[ARRAY_SIZE]) { int p = 0; for (int r = 0; r < 4; r++) { for (int i = p; i < ARRAY_SIZE; i++) { if (array[i] % 5 == r) { if (i != p) { int temp = array[p]; array[p] = array[i]; array[i] = temp; } p++; } } } }

Viewing 181 - 190 interview questions

Glassdoor has 5,469 interview questions and reports from C interviews. Prepare for your interview. Get hired. Love your job.