zoukankan      html  css  js  c++  java
  • 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
    ", 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	", iArry[i]);    
    14         printf("%d	", i[iArry]);    
    15     }
    16     printf("
    ");
    17 
    18     int *ptrArry = iArry;
    19     for(int i = 0; i < size; i++){
    20         //printf("%d	", *(ptrArry + i));    
    21         printf("%d	", *(i + ptrArry));    
    22     }
    23     printf("
    ");
    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
    ", var1);
    46 
    47     outStu(*ptrStu);
    48 
    49     return 0;
    50 }

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

    人就像是被蒙着眼推磨的驴子,生活就像一条鞭子;当鞭子抽到你背上时,你就只能一直往前走,虽然连你也不知道要走到什么时候为止,便一直这么坚持着。
  • 相关阅读:
    各进制字符串转换
    小度智能音箱开发
    讯飞魔飞智能麦克风-->直接输出串口
    node express SSL 证书布署
    紫外线消毒灯智能控制系统
    智能家居解决方案
    Git 分支管理
    C语言MQTT库MQTTPacket.c使用,尤其接收
    Vue 数组控制CSS
    AOP_02 通过ContextBoundObject、ContextAttribute 上下文对象实现
  • 原文地址:https://www.cnblogs.com/guochaoxxl/p/15236835.html
Copyright © 2011-2022 走看看