C language-pointers and functions (1)

Source: Internet
Author: User

1. pointer to the function:

Declaration format: Data Type (* function pointer variable name) (List of function parameter identifiers)

The function pointer variable points to the function entry address, that is, the array name;

For example, char (* PF) (char *, INT );

This function pointer pf can point to a function whose type is char *, Int, and char.

2. pointer assignment to functionFormat:

Function pointer = function name;

3. function pointer call, Format:

(* Pointer name) (real parameter list)

Returns a pointer to a function. After a function is called, the returned value is a pointer function, which is a pointer function. It is defined as int * func (int x, int Y );

4. Command Line Parameters

Program Design Process:

(1) design a program. The main function has two parameters, one of which is an array of pointers to the command line and the other is the number of command line parameters.

the main function is in the form of int main (INT argc, char * argc []).

argc: Number of command line parameters (including commands). The argv value of the pointer array is automatically run during program execution.

(2) Compile the program. The. c file name of the main function is the command name.

(3) Compile the program.

(4) execute a program in the command line environment in the following format:

command line parameter 1 parameter 2 parameter 3 parameter 4... Parameter n (Press ENTER)

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.