Home > Article > Backend Development > 15 C language development interview questions (original questions shared)
The following are the written test questions for a software position in a company that focuses on Linux platform development that the subject participated in. I will share the original question and attach part of the reference answer for the subject's 91 points^V^)
1. (8 points) What result does the program output?
char *getStr(void) { char p[] = "hellow world"; return p; } void test(void) { char *str = NULL; str = getStr(); printf(str); }
2. (5 points) Is there any problem with the test2 function? If so, please explain where the problem lies and give the correct answer.
void test2() { char string[10], str[10]; int i; for(i = 0; i < 10; i++) { str[i] = 'a'; } strcpy(string, str); }
3. (5 points) Use the preprocessing directive #define to declare a constant to indicate how many seconds there are in a year. (Ignore the leap year issue)
4. (5 points) Write a "standard" macro MIN, which takes two parameters and returns the smaller one.
5. (8 points) How do you write an infinite loop in C?
6. (10 points) Use variable a to give the following definition:
1. An integer;
2. A pointer to an integer;
3. A pointer to a pointer, the pointer it points to is an integer;
4. An array of 10 integers;
5 , an array of 10 pointers, which points to an integer;
6, a pointer to an array of 10 integers;
7, a pointer to a function A pointer, the function has an integer parameter and returns an integer;
8. An array of 10 pointers, the pointer points to a function, the function has an integer parameter and returns an integer Number;
7. (5 points) What is the function of the keyword static?
8. (10 points) What does the keyword const mean?
What do the following statements mean?
1) const int a;
2) int const a;
3) const int *a;
4) int *const a;
5) int const *a const;
9. (5 points) What is the output of the following code? Why?
void foo(void) { unsigned int a = 6; int b = -20; (a - b > 6) ? puts(">6") : puts("<=6"); }
10. (5 points) What are the possible problems that may occur with dynamically allocated memory?
11. (5 points) What is the function of the keyword volatile?
12. (8 points) How many ways are there to communicate between processes? What are they?
13. (8 points) Please write the output result of the following program:
#include<stdio.h> int main() { int a = 10, b, c, d; b = a++; c = ++a; d = 10 * (++a); printf(" b : %d , c:%d, d :%d ", b , c, d); return 0; }
14. (5 points) What is the difference between a process and a thread?
15. (8 points) Please list the four bitwise operators and explain where they are generally used.
Part of the reference answer:
## Recommendation: "c Language Tutorial》
The above is the detailed content of 15 C language development interview questions (original questions shared). For more information, please follow other related articles on the PHP Chinese website!