C language function parameters are empty and void

Source: Internet
Author: User

C language function parameters are empty and void
Is the function parameter null in C language the same effect as marking them with void?

# 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); 10 return 0; 11} 12 int add (a, B) 13 {14 return a + B; 15}

 

In C language, the most important standard for function declaration detection is the function name. in C language, the parameter name in the function parameter list can be the default data type in the parameter list in C language, and the default value is int. Add () is not equivalent to add (void); add (void () it indicates the receiving parameter. Its type is int, but it is meaningless and will not be used. The prompt is wring;

Related Article

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.