C-language function parameters are null and void

Source: Internet
Author: User

is the function parameter in C language empty and the same as void label?

#include <stdio.h>
2//int Add ();
3 int Add (void);
4 int main (void)
5 {
6 int i;
7 i = Add (5, 6);
8
9 printf ("%d\n", I);
return 0;
11}
int Add (A, B)
13 {
return a + B;
15}


The most important criterion for function declaration in C language is the function name, and the parameter name in the function parameter list in C language can be the default


The data type in the parameter list in the C language can also be defaulted by default, int.


Add () is not equivalent to add (void); Add (void) explicitly indicates that the ADD function does not receive any parameters, and if the error is transmitted to the participant, the hint is error;

and the Add () indicates the receive parameter, his type is int, just he is a kind of meaningless receive, and will not use this parameter, hint is wring;


C-language function parameters are null and void

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.