constant
1. Literal constants
34 58 39 382
2, const constant attributes
const int a = 10 //a constant attribute cannot be changed
3. #define defines the constant identifier
#define MAX 10;
4. #enum enum constants // one by oneSuch as Wednesday primary color sex
enum Color(){
YELLOW;
RED;
BLUE;
}
int main () {
printf("%d\n",YELLOW);
return 0;
}
String + escape character + comment
String: "Are you ok?" Characters surrounded by double quotes are called strings.
Note: The end mark of the string is \0 which represents the escape character.
Escape character:
Comment: // /**/
Array: store a bunch of things
int arr[10]={1,2,3,4,5,6,7,8,9,10}; //Access 10 numbers
int main () {
int a =0;
while(a<10){
printf("%d\n",arr[a]);//Remove the 10 numbers stored in the array arr
a++;
}
return 0;
}
Select statement if
int main () {
int a = 0;
printf("If you want to learn c language, please enter 0 or 1\n","");
scanf("%d", &a);
if (a==1){
printf("Learn more to work\n");
}
else
{
printf("Enter to work\n");
}
}
Loop statement while
int arr[10]={1,2,3,4,5,6,7,8,9,10}; //Access 10 numbers
int main () {
int a =0;
while(a<10){
printf("%d\n",arr[a]);//Remove the 10 numbers stored in the array arr
a++;
}
return 0;
}
Operator
1. Arithmetic operators
+ - * / %
2. Shift operator
>> <<
3. Bit operator
& | ^
4. Assignment operator
= += -= *= /= ^= |= >>= <<=
5. Unary operator