zoukankan      html  css  js  c++  java
  • 【c学习-3】

    ---恢复内容开始---

    #include<stdio.h>
    int main(){
        int a[5]={1,2,3,4,5};
        int i=0;    
        for(i=0;i<=5;i++){
            printf("%d
    ",a[i]);
            if(i==4){
                printf(",");
            }
            
        } 
        putchar("
    "); 
    }


    #include<stdio.h>
    int main(){
        int arry[3][4]={{1,2,3,4},{5,6,7,8},{0,0,0,9}};
        int i,j=0;
        for(i=0;i<3;i++){
            for(j=0;j<4;j++){
                printf("arry[%p][%p]=%p",j,j,arry[i][j]);
            }
            printf("
    ");
        }
            
        
    }
    
    
    




    #include<stdio.h>
    int main(){
        /*int i=0;
        int a[10]={'H','e','l','l','o'};
        printf("%ld
    ",sizeof(a));
        char b[10]="hello";
        memset(b,'a',10);  //覆盖字符函数 
        for(i=0;i<10;i++){
            printf("%c
    ",b[i]);
        }
        int length=strlen(b);  //字符长度函数 
        printf("length=%d
    ",length);
        */
        char x[]="123";
        char y[]="12";
        char z[20]=""; 
        int diff=strcmp(x,y);  //字符比较函数 
        printf("%d
    ",diff);    
        //strcpy(z,y);              //字符复制函数 
        //printf("z=%s
    ",z);
        strncpy(z,x,1);
        printf("z=%s
    ",z);        //字符复制函数升级版 
        strcat(x,y);             //字符拼接函数 
        printf("x=%s
    ",x);
        
        
        /*    if(diff>=0){
            printf("x>y");
        }else if(diff<0){
            printf("x<y");
        }else{
            printf("x=y");        
        }
    
    */
    }
    
    
    #include<stdio.h>
    int funX(int a,int b){
        return a+b;
    }
    int main(){
        
        funX(1,2);
    }























    ---恢复内容结束---

    要保持着对知识的渴求,给自己充电,不要这荒废了短暂的时光;
  • 相关阅读:
    composer require 指定版本
    后台管理,有无限可能
    str_replace 批量查找替换字符串
    node项目配置成nginx启动
    nodejs项目安装ant design
    in_array的三个参数
    Tp5.1使用导出Excel
    php 中 public private protected的区别
    Seafile 文件访问日志时间不一致问题
    du -sh *
  • 原文地址:https://www.cnblogs.com/activecode/p/9475873.html
Copyright © 2011-2022 走看看