intrinsic and external functions

Source: Internet
Author: User

Intrinsic functions

// static type name Function name (parameter table) // For example: Static int Fun (int A,int  b)// means fun is an intrinsic function and cannot suppress other file calls //  internal function is also called static function

External functions

// If you are defining a function, add the keyword extern to the leftmost side of the first // This function is an external function that can be called by other files extern int Fun (int A,int b)

If you omit extern when defining a function, the default is an external function.

How to use external functions specifically, the following example

//file1.c file 1#include <stdio.h>intMain () {extern voidEnter_string (Charstr[]); extern voidDelete_string (CharStr[],Charch); extern voidPrint_string (Charstr[]); Charc,str[ the];    Enter_string (str); scanf ("%c",&c);    Delete_string (STR,C);    Print_string (str); return 0;}//file2.c File 2voidEnter_string (Charstr[ the])//define an external function enter_string{gets (str); //enter a string into a character array}//file3.c File 3voidDelete_string (CharStr[],Charch) {    inti,j;  for(i=j=0; str[i]!=' /'; i++)        if(str[i]!=ch) str[j++]=Str[i]; STR[J]=' /';}//file4.c file 4voidPrint_string (Charstr[]) {printf ("%s\n", str);}

intrinsic and external functions

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.