形参是在定义函数时用于接收输入的变量,而实参是在调用函数时传入的具体值 TCP Linux

·

1 min read

形参(Formal Parameter)和实参(Actual Parameter)是函数定义和调用中的两种类型的参数。形参是在定义函数时用于接收输入的变量,而实参是在调用函数时传入的具体值。

#include <stdio.h>

void print_num(int num) {  // "num" 是形参
    printf("%d\n", num);
}

int main() {
    int a = 5;
    print_num(a);  // "a" 是实参
    return 0;
}

在这个例子中,numprint_num 函数定义中的形参,用于接收一个整数输入。而在 main 函数中,我们调用 print_num 函数并传入实参 a,这里 a 的值是 5。

inet_aton() converts the Internet host address cp from the IPv4 numbers-and-dots notation into binary form (in network byte order) and stores it in the structure that inp points to. inet_aton() returns nonzero if the address is valid, zero if not. The address supplied in cp can have one of the following forms:

The inet_ntoa() function converts the Internet host address in, given in network byte order, to a string in IPv4 dotted-decimal notation. The string is returned in a statically allocated buffer, which subsequent calls will overwrite.

In Unix-like operating systems, "man 2 accept" displays the manual page for the accept system call in section 2 (which is dedicated to system calls), while "man accept" displays the first manual page it finds named accept, which could be in any section. If there's an accept in a lower-numbered section, "man accept" would display that before it would display accept from section 2.