1) source File comparison
Think & Implement 1:1) in the C language, what are the files that we encounter with different suffixes?
. C. O. h
2. Basic grammatical comparison
1) Data type comparison learning
2) definition Comparison of variables
3) Comparison of flow control statements
1) if else 2) switch 3) while 4) do and 5) for
Added: Enhanced for loop for fast traversal of arrays, dictionaries, and other collections
4) function (method) definition and declaration comparison
Declaration and implementation of functions in C language
I. Function declaration:
int sum (int a,int b);
II. function definition
int sum (int a,int b) {
return a+b;
}
The function habit in OC language is called "method"
I. Method declaration:
-(int) sum: (int) A and: (int) b;
II. METHOD definitions
-(int) sum: (int) A and: (int) b{
return a+b;
}
5) OC New data type
A Boolean type is a variable used to store true and false values, and is typically used for program flow control.
The Boolean data allows for a value of true or FALSE, or an integer of 0 or not 0 to replace true and false, which differs from the Java language.
6) New Exception Capture method in OC @try ... @catch ... @finally
Format:
The code may throw a possible exception that is enclosed at an @ try block. The @catch () block contains exception handling logic for exceptions thrown for the @ try block. An @ finally block contains code that must be executed to throw an exception or not. You can use the @throw directive to throw an exception, which is basically a pointer to the Objective–c object. You can use the NSException object
The instruction throws an exception, which is basically a pointer to the Objective–c object. You can use NSException objects but not them.
C and OC Comparisons