iOS Getting Started Tutorial (iii)-C language Features

Source: Internet
Author: User

3.C language Features//3.1 function definition//function return type function name (parameter) {//dosomthing//} General function definitions are like this,//There is an ancient function definition, and another line to explain the parameters of void Printmesg (ms  g,loopnum) int loopnum;  int msg;      {int i;      for (i = 0;i<loopnum;i++) {printf ("%d cycles%d \ n", i+1,msg);  }}//3.2 function declaration//function declaration is used for the use of functions before the definition of int add (int a,int b);  int main () {//int maxInt = Add (3,8);  } int Add (int a,int b) {return a+b;   } The//3.3 parameter is passed, OBJECT-C uses the value to pass void swap (int a,int b) {int temp = A;   A = b;   b = temp;  printf ("A is the value of%d,b is%d", A, b);   }//For pointer-type variables, the same is used for value passing/* Draw is a class with two attributes int a,int b; void swap (Draw * DW) {int temp = DW.A;   DW.A = dw.b;  dw.b = temp;   } int main () {Draw DW = [Draw alloc] init];   DW.A = 6;   dw.b = 9;  return 0; } *///DW is a pointer variable that is passed when the value is passed, and the pointer itself is copied,//But it is strange that the pointer is manipulating a draw object, regardless of which pointer, the//is the draw object. So the attribute change is taken for granted.//3.4 recursive function//3.5 intrinsic function and external function/* Intrinsic function: The definition uses a static modifier, which can only be called by a function in the current source file, so it is called an inner function external function: the definition uses an extern decoration, or does not use any modifiers, he can  Called by any source file, this function is called an external function, and the general function is an external function. *///define extern function, omit exTern is also allowed extern printrect (int height,int width) {for (int. i=0;i

iOS Getting Started Tutorial (iii)-C language Features

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.