zoukankan      html  css  js  c++  java
  • C语言中memchr和strchr和strlen函数使用

    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <pthread.h>
    #include <semaphore.h>
    #include <unistd.h>
    #include <signal.h>
    #include <string.h>
    
    
    // static
    static int seq[] = {1,2,3,4,5,6};
    static const char* string[] = { "a","b","c","d"};
    
    static char* pstring=  "http://www.ABCD.com";
    
    int main()
    {
        int i = 20;
    
        // memchr
        int* pseq = memchr(seq,2,sizeof(seq)/sizeof(int));
        printf("pseq is %d
    ",pseq[1]);
        char*pstring1 = strchr(pstring,'A');
        printf("string is %s
    ",pstring1);
        char*pmstring = memchr(pstring,'A',strlen(pstring));
        printf("pmstring is %s
    ",pmstring);
        //char *strchr(const char *str, int c)
        //char* pstrstring = strchr(string,'b');
        printf(" length is %d 
    ",strlen(pstring));
    
        while(1);
    
        return 0;
    }
    

      

    一勤天下无难事。
  • 相关阅读:
    HTML中Css补充资料
    HTML表单
    HTML盒子模型
    标准文档流
    什么使用面向对象
    static修饰
    static修饰
    列表样式
    java基础(9)
    java基础(8)
  • 原文地址:https://www.cnblogs.com/nowroot/p/13658909.html
Copyright © 2011-2022 走看看