Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the interview questions in C language?

Shulou Source: shulou.com Published: 2022-06-01 22:05:19 09月21日 Update

This article mainly introduces "what interview questions are there in C language". In the daily operation, I believe that many people have doubts about what interview questions there are in C language. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what interview questions are there in C language"! Next, please follow the editor to study!

1. What is the key role of static in the c language? (when you see this question, readers can think about it for themselves before looking at the answer.)

Answer:

(1) in the body of a function, a variable declared as static keeps its value unchanged during the call of the function.

(2), in the module, the module is the ".C" file you wrote (outside the function). A variable declared as static can be accessed by the function used in the module, but not by other functions outside the module. It is equivalent to a local static global variable (note the difference between it and non-static global variables).

(3) in a module, a function declared as static can only be called by other functions in this module. That is, this function is restricted to use locally in the module in which it is declared, and cannot be used outside the module.

2. Write a "standard" macro that enters two parameters and returns the smaller one; at the same time, tell the difference between # and #?

Answer:

(1) the first question can be written like this, and notice that the trinomial operator is used in it:

# define MIN (XBI y) ((x)

Tags: Space variable function module language static action global answer parameter data learning code constant user result operator problem operation two Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn Linux MySQL Docker