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);
    }























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

    要保持着对知识的渴求,给自己充电,不要这荒废了短暂的时光;
  • 相关阅读:
    1108递归
    1108JS函数
    1107数组例子
    1106JS循环
    1106JS数组
    1104JS语法
    1104JS循环
    PDO概念 分析 练习
    Jquery网页元素里面的操作以及JSON
    Jquery事件
  • 原文地址:https://www.cnblogs.com/activecode/p/9475873.html
Copyright © 2011-2022 走看看