I have been writing a function since I started learning C language, so do you know its standard writing method?
The main function, also known as the main function, is the starting point for program execution. What does the main function we usually write look like?
1. Is that so?
main(){}
2. Is this still the case?
void main(){}
3. Still like this?
int main(void){}
4. Still like this?
int main(){}
5. Still like this?
int main(int argc,char *argv[]){}
There are so many ways of writing above, so which one is the correct way of writing?
Check the C89/C99/C11 standard document, which clearly fixes two ways of writing:
int main(void) { /* 。。。。。。 */ }int main(int argc, char *argv[]) { /* 。。。。。。 */ }
Therefore, other writing methods do not meet the standards. Some are historical relics, some are compiler extensions, and some are unknown where they came from.
So having said all this, for the general portability of the code, it is recommended to use the form provided by the standard, or it is recommended to use the two writing methods specified in the standard document. If a function determines that no parameters need to be passed in, then using void qualification is a good choice.
So, do you understand how to write the main function?
Previous article:How much do you know about the internal structure of a microcontroller?
Next article:Design of VIIC1.0 software package based on I2C bus application calling platform mode
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- FPGA most downloaded related materials
- What does it mean to connect an isolated 485 transceiver and a non-isolated transceiver in parallel?
- How to understand the equivalent of capacitors passing AC
- Solution to the error message when downloading the program on TMS320F28379D in CCS
- [BLE 5.3 wireless MCU CH582] 7. Button - GPIO external interrupt
- Switching power supply parallel current sharing technology
- Some simple knowledge collected about RFID standards
- TMS320C50 Example Programming Sharing
- Don’t know why???
- A novice wants to know why this variable is locked...