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 }
复制代码

代码简单,请同学们自行练习

posted @   叕叒双又  阅读(73)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示