4.8.29 struct. Function

Source: Internet
Author: User

(1) struct

Then you can define the following in the main function:

1 static void main (string [] ARGs) 2 {3 student Stu = new student (); 4 Stu. name = "Zhang San"; 5 Stu. no = 20140813; 6 Stu. age = 24; 7 8 console. writeline ("My name is {0}, I am {1} years old, my student ID is {2}", Stu. name, Stu. age, Stu. no); 9 console. readkey (); 10}

 

(2) Functions

Four elements of a function: function name, input, return value, and function body

1 static void main (string [] ARGs) 2 {3 int x = 3, y = 5; 4 console. writeline ("the maximum value is {0}", max (x, y); // The actual parameter 5 console is in brackets during the call. readkey (); 6} 7 static int max (int A, int B) // The brackets contain 8 {9 If (A> B) 10 {11 return; 12} 13 else14 {15 return B; 16} 17}

4.8.29 struct. Function

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.