20210907
1 #include <stdio.h> 2 3 //int main(int argc, char **argv) 4 int main(int argc, char *argv[]) 5 { 6 for(int i = 0; i < argc; i++){ 7 printf("%dth O: %s\n", i+1, *(argv + i)); 8 } 9 10 int iArry[] = {1, 4, 5, 8, 3, 2}; 11 int size = sizeof(iArry)/sizeof(int); 12 for(int i = 0; i < size; i++){ 13 //printf("%d\t", iArry[i]); 14 printf("%d\t", i[iArry]); 15 } 16 printf("\n"); 17 18 int *ptrArry = iArry; 19 for(int i = 0; i < size; i++){ 20 //printf("%d\t", *(ptrArry + i)); 21 printf("%d\t", *(i + ptrArry)); 22 } 23 printf("\n"); 24 25 return 10; 26 }
1 #include <stdio.h> 2 #include <stdbool.h> 3 #include <string.h> 4 #include <stdlib.h> 5 6 //#define DataType int 7 // 8 #define Size 10 9 10 typedef int DataType; 11 12 /*struct _stu{ 13 int id; 14 bool sex; 15 char name[Size]; 16 };*/ 17 18 typedef struct _stu{ 19 int id; 20 bool sex; 21 char name[Size]; 22 } Student; 23 24 //void outStu(struct _stu stu){ 25 void outStu(Student stu){ 26 printf("%s info: id-%d sex-%d", stu.name, stu.id, stu.sex); 27 } 28 29 int main(int argc, char **argv) 30 { 31 //struct _stu stu1; 32 /*Student stu1; 33 stu1.id = 100; 34 stu1.sex = 0; 35 strcpy(stu1.name, "zhangsan");*/ 36 37 Student *ptrStu = (Student *)malloc(sizeof(Student)); 38 /*(*ptrStu).id = 100; 39 (*ptrStu).sex = 0; 40 strcpy((*ptrStu).name, "zhangsan");*/ 41 ptrStu->id = 100; 42 ptrStu->sex = 0; 43 strcpy(ptrStu->name, "zhangsan"); 44 DataType var1 = 3; 45 printf("%d\n", var1); 46 47 outStu(*ptrStu); 48 49 return 0; 50 }
代码简单,请同学们自行练习
人就像是被蒙着眼推磨的驴子,生活就像一条鞭子;当鞭子抽到你背上时,你就只能一直往前走,虽然连你也不知道要走到什么时候为止,便一直这么坚持着。