first sentence can be defined by a curly brace;Compiler bugThe default statement can be placed anywhere on the switch, and break can be omitted; The default statement will also penetrate!Case penetrates, if default is not penetrated prior3. If statement and switch statement selectionIt is best to use if when branching is more and cannot be exhausted or a large number of enumerations are used.If the number of branches is not many, but the use if code code is larger than the time, you can choose
1------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------Dark Horse
What is polymorphic?Polymorphism (polymorphism) literally means "multiple states." In object-oriented languages, many different implementations of interfaces are polymorphic. The description of polymorphism is referenced by Charlie Calverts-polymorphism is a technique that allows you to set a parent object to be equal to one or more of his sub-objects, after which the parent object can operate differently depending on the attributes of the child object currently assigned to it. To put it simply:
:Alloc: Allocates memory for a new object and resets its reference count to 1. Call the Alloc method and you have ownership of the new object.Retain: Is the reference count of the object +1, and gets the reference to the object.To release a reference :Release: is the reference count of the object minus 1.Autorelease: The reference count of the object is reduced by 1 at some point in the future, and the current reference count does not change.When the reference count is 0, the system automatical
; 8: 9: if (count%10 = = 0) Ten: One : { : : //end this cycle directly and enter the next cycle : : continue; : : } : : printf ("Do%d push-ups \ n", Count); : : } : Four. The common dead loop of the while statement1. The simplest cycle of death 1: while (1);2. Never-ending "hahaha" 1: while (10) 2: 3: { 4: 5: printf ("haha \ n"); 6: 7: } 8: Five. While application small example 1: /* 2: 3:
1. Definition of pointersFormat: Variable type * variable name; 1: //defines a pointer variable p 2: //pointer variable can only store address 3: //Pointer is a function: can access the corresponding storage space according to an address value 4: //pointer variable p before INT: pointer variable p can only point to data of type int 5: 6: int *p;2. Pointers pointing to pointers3. Pointers and Arrays1) How array elements are accessed int ages[5];int *p;p = ages
1. Specific usage 1: int b; 2: int a = 10; 3: //b = ten +; 4: //b = (a++) + (++a); 5: 6: //b = one + one; 7: b = (++a) + (a++); 8: //a -one 9: 10: One : //A:12 : printf ("b=%d, a=%d\n", B, a);2. The difference between "++a" and "a++"Add in front and add after3. Questions about Lvalue ("left value") 1: int A; 2: (-a) + +;This code is wrong, because "-a" is not a variable, cannot be assigned, it can
values, and so on***************#include int main (){/prompt a variable to store the value entered by the userint n = 0;Judging the value of n is not reasonablewhile (n {Prompt user to enter a positive integerprintf ("Please enter a positive integer: \ n");scanf (%d,a);}Output graphicsfor (int i=0; i{for (int j=0;j{printf ("*");}pintf ("\ n");}return 0;}Additional Knowledge supplementBreak and Continue use noteBreak Use occasions1.switch statement, exit the entire switch statement2. Loop struct
first, the basic concept of structural bodyArray: Can consist of more than one data of the same typestruct: Can consist of many different types of dataCode Exercise:#include 1. Define struct type struct person (does not allocate storage space)struct person {int: age; Double height; char *name;}; //2. Define struct variables (true allocation of storage space) based on struct typestruct person P ={20,1.55, "Jack"}; P.age = +; //Modify the value of a struct element P.
depending on the scope of the variable, it can be divided intoLocal Variables:Definition: A variable defined inside a function or code blockScope: Start with the line that defines the variable until the end of the code blockDeclaration period: Allocates storage space from the line that defines the face, which is recycled after the code block is finishedNo fixed initial valueGlobal Variables:Definition: A variable defined outside a functionScope: Starts from the line that defines the variable, un
------Two-dimensional arrays:Can be seen as a special one-dimensional array, and each element of this one-dimensional array is a one-dimensional arrayDefinition of a two-dimensional arrayData type array name [length of first dimension (row)] [Length of second Dimension (column)];int a[2][3];Understanding Method:1) This is a special one-dimensional array, one-dimensional array has two elements a[0] a[1]A[0] It also stores a one-dimensional array with an array length of 32) defines a matrix of 2 r
{ - return "Gaizuojia"; -}Vi. Pointers to functions1. Define pointers to functions1 Double (*p) (doublecharint); 2 3 p = haha;orDouble (*p) (doublecharint) = haha;2. How to call functions indirectly①p (10.7, "Gaizuojia", 10);② (*p) (10.7, "Gaizuojia", 10);3, there is a return value function pointer definition1 // define pointer variables to point to the SUM function 2 // int on the left: the function that the pointer variable p points to returns data of type int 3 // Right
whole C language, as the teacher said, if the pointer did not learn well, C language learning is also equivalent to not learning C, visible pointers in C language learning importance, and this chapter mainly learn the definition and use of pointers to pointers, pointers and arrays , pointers and strings, pointers to f
an int type variable for use in numeric Exchange A CharTemp2;//defines a char type variable for character Exchange + for(intI=0; i//For Loop traversal the for(intj=0; j//sort ABCD in descending order - { $ if(b[j].p1].P) the { theTEMP=B[J].P;//If the previous character appears less than the last one to be swapped theb[j].p=b[j+1].P; theb[j+1].p=temp; -TEMP2=B[J].Q;//Character type Exchange inb[j].q=b[j+1].q; theb[j+1].q=Temp2; the About } the the } the +}The use of the structure in the--
function pointer variable. 2. Assign the function pointer variable to the entry address ( function name ) of the transferred functions , as in the first row of the program Pmax=max;3. call the function in the form of a function pointer variable, such as z= (*pmax) (x, y) of the program; the general form of the calling function is: (* pointer variable name ) ( argument table ) You should also note the following two points when using function pointer variables:A. function pointer variables ca
more encouragement, go forward together.I have always believed that interest is the driving force of the continuous, this experience has witnessed the fact that I will continue to keep. Those who consulted my friends, basically also because of interest in learning, so I feel that it is necessary to guide. Although I am not high enough, but it is also a beginner and novice and self-academic perspective, so that they can really get a clear direction. The following is a detailed talk about
In the past year, the discussion list of various discussion forums or emails on the Internet has been
VB. NET
And
C #
To explore the advantages. The main problems that these discussions focus on are: Which one should I learn first,
VB. NET
Or
C #
?
I forward this articleArticleThe purpose is to help you solve this problem. I don't want to shake your preferred language, but want to so
Programmer --- C language details 8Main Content: function parameter transfer, declaration, and other details
# Include
Int ff (); // 1. When the char, short, and float types are not in the function parameter list (int and double types can be omitted ), the parameter type description can be omitted in the function declaration, // but the parameter type cannot be omitted in the definition. // 2. The
. Other source files can use these functions by including the header file or by declaring it (the former is recommended).A good programming habit is to declare a prototype of a function in a header file. This makes it easy for the compiler to check for errors. When defining a function, the default function type is an external function. Such as:void fun2 (void); extern void fun2 (void);The function type is equivalent, but the previous one is the definition function, and the next one is declaring
in the array*/3 4 Address:5 1. printf"%d", a[0]);//output address is 16382126 7 2. printf ("%d", a);//output address is 1638212the difference between 4.printf and puts is the same as the output function:①printf can output multiple elements at the same time, separated by commas, but the put can only output a single element at a time②printf output is required to add "\ n" to wrap, and puts to wrap.int main (int argc,const char * argv[]) { printf ("Black Horse, Hello! \ n "); Puts ("Black Ho
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.