Some special usage of C language -------- [Badboy], C language badboy
I. Special string macros
[Cpp]
# Define A (x) T _ # x
# Define B (x) # @ x
# Define C (x) # x
Assume that x = 1, the macro definition above will be interpreted as follows:
A (1) ------> T_1
B (1) ------> '1'
C (1) ------> "1"
These functions are mainly used in string processing functions and parameter naming. They are not complex, but few are known.
Ii. Shielding useless parameter warnings
[Cpp]
# Define UNUSED_PARAM (p) (void) p)
This is used to block invalid Parameters
For example
[Cpp] view plaincopy
Void a (int x1, int x2)
{
// Do nothing
}
A warning is displayed. x1 and x2 are invalid parameters.
However, it doesn't matter if you write it like this.
[Cpp]
Void a (int x1, int x2)
{
UNUSED_PARAM (x1 );
UNUSED_PARAM (x2 );
}
3: I can't think of it. I want to hold a place and wait until I wake up.
I will not write more common macro usage, such as the header file security macro, version definition macro, flexible use indeed get twice the result with half the effort.
Some special usage and Use of C language in single-chip microcomputer programming?
As you said, your interest lies in software rather than hardware. The major feature of electronic information engineering is the combination of hardware and software. Even if you do not like complex circuits, it is also necessary to have a good circuit Foundation. If the hardware foundation is not solid, there is no way to talk about the software. Of course, I am referring to the development of embedded systems, information and signal processing, pattern recognition, and other software. It is also the housekeeping skill and main direction of telecom engineers.
Of course, if you want to develop software without hardware, the telecommunications industry will have no advantage, because it is difficult for the telecommunications industry to study software better than the computer industry, because I am a Telecommunications Engineering Professional and have computer and software students in the lab, I have a deep understanding that the courses I have learned differ greatly from the system exercises I have obtained, programming ideas and habits, as well as mastering algorithms, cannot be compared with them. Therefore, the biggest advantage of telecom workers is the combination of hardware and software for hardware-based software development, that is, the above several directions.
C ++ is indeed difficult, but it is easier if you don't need to design object-oriented visual programs. As long as you have the foundation of C, you can learn it easily. If you want to develop some visualization programs, whether it's API or MFC, It's not quick. You need to practice and accumulate more experience. If you want to become a single-chip microcomputer master, you can learn C well, and it is basically C, pointers and so on are rarely used. C ++ can study in depth if you are interested. After all, it is a good capital and advantage for future projects. Of course, it is a prerequisite for learning professional courses well. In fact, the host computer program of telecom projects can be completed in VB, which is easier to get started and learn.
Some special functions in C Language
C language does not have fmax () and power () Functions
Evaluate the maximum value of fmax () and implement the function itself.
In C, the function pow (a, B) is used to calculate the power of B. The header file math. h must be included.
References: Special Functions