当前位置: 首页 > news >正文

广告投放网站平台网站优化分析

广告投放网站平台,网站优化分析,在线教育网站开发文档,做网站建设销售工资数组的指针 在c中&#xff0c;几乎所以使用数组名的表达式中&#xff0c;数组名的值是一个指针常量&#xff0c;也就是数组 第 一个元素的地址。注意这个值是指针常量&#xff0c;不是变量。 int a[10]{ ….....}; int *q; q&a[0] ; <>…
  1. 数组的指针 

                    在c中,几乎所以使用数组名的表达式中,数组名的值是一个指针常量,也就是数组               第   一个元素的地址。注意这个值是指针常量,不是变量。 

           int  a[10]={   ….....}; 

           int    *q; 

           q=&a[0] ;   <=>  q=a;    //这两句是等价的。 

    

           但是,a=q   是非法的,因为a是常量。 

           a[5]=*(q+5)       //数组下标等价于数组的指针间接寻址。 

          int    a[10]={….....}; 

          int   *p=a;      //一定要理解,非常重要。 

          注意  int   *p    是定义的p为整型指针变量,如初始化必须是指针类型值。 

           如: 

           char   c='a'; 

           char    *q= &c; 

           特别要理解字符串常量这个特殊情况:

           char   *q="hello world.";          //"hello world" 的值为存储这个字符串常量的地址指针。

           到现在就可以很好理解scanf输入什麽时候加&符号了

            如:

            char   c[10];

            int    t;

            scanf("%d",&t);      //注意t前面必须加& 地址符号。

            scanf("%s",c);        //因为c就是指针类型。同样。printf("%s",a) a也是指针类型。

            c语言中,任何字符串常量的值的类型都是指针类型。

           所以,只有见到函数参数是  char  *  或者const   char  *   就是要输入字符串。

          如:c中打开文件的函数    

                   FILE  *  fopen(const   char   *restrict, const  char  *restrict)

                   此函数的意思就是函数返回值为FILE类型的存储指针,如打开成功,返回打开文件运行代码的内存地址指针,失败,返回NULL。  参数1为文件路径名加文件名,用字符串常量表示,如"/home/wjs/2.c",  参数2 为字符串常量,如" r" ,  "w","a","r+","w+","a+",表示读写方式。     

          c语言中规定:关于函数参数,在函数原型或函数定义的场合中(并且也只有在这两种场合中),可以用 int  *p 代替 int  p[ ]  

           fun( int  *p)         <==>   fun (int  p[ ])     等价

#include <stdio.h>
#include <string.h>
#define A "hello world."

int test(int *p);
int main(void){
    int t[10]={1,2,3,4,5,6};
        test(t);    
    return 0;
       

}
int test(int *p){
    printf("%d\n",p[3]);       //4
    printf("%d\n",*(p+3));     //4
    return 0;
}
 

2.       #define    A      B        把b自定义 A 

          如定义字符串:   #define    HELLO    "hello   world" 

           定义数值               #define     LEN       10 

3.       const     修饰,表示不可变 

          const    int   t[10]         不可变数组 

         const     int  t=10         不可变变量 

4.    c 语言的字符串就是以\0结尾的char数组。

       字符串常量或者叫字符串文字是指用一对双括号包围的任何字符,系统自动加\0.

          

        <1> c语言的字符串定义:

         先定义字符串 c :       char   c [ 20]={..........  ,'\0'};

         程序中可以直接用c  代表字符串了

        <2>  字符串常量的定义

           a:    #define    A    ”hello world."

           b:   char  c[20]="hello  world."

           c:   char  *p="hello  world"        //特别要理解,这里赋值是字符串常量的地址指针。可以参看下面的代码理解

          printf("%c\n", *"hello");    //   输出 h,"hello" 的值为字符串hello内存存储地址的指针。

  char *p="hello world.";
        for(int n=0;n<strlen(p);n++){
        printf("%c\n",*p);
        p++;
    }

     输出为  h   e  l    l  o   

scanf   输入时系统自动加如\0 空白符。printf  函数可以直接输出 字符串数组。如不加空白符,那是字符数组 .printf() 也能直接输出 字符数组。这和java  输出数组就有区别。

         char   c[20];

          scanf("%s",c);

          printf("%s\n",c);      //直接输出。

5     键盘输入:

        a.    char  c=getchar()    //一个字符的输入

        b.    char  c[20];     gets(c);         //一个字符串的输入,可以包括空格等,不推荐使用。

        c.    char c[20];  char  *p;   p=fgets(c,20,stdin);    //输入一个字符串,推荐用。

        d.   char c[20];    scanf("%s",c)    //可以输入字符串。整数。浮点数,字符等

6.    屏幕输出

      a.  putchar('a');             //输出一个字符

      b.  puts(&);          //& 表示输出字符串的地址指针

           如: puts("hello");

                    char   *p="hello";    puts(p+1); //ello

     c.  char c[20]="hello";   fputs(c,stdout);

     d.  printf(  )

========================================================

c  服务器与客户端 for deepin

服务器:

  

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
void error_handling(char *message);int main(int argc,char *argv[]){int serv_sock;int clnt_sock;struct sockaddr_in  serv_addr;struct sockaddr_in  clnt_addr;socklen_t   clnt_addr_size;char message[]="hello nanning";if(argc!=2){printf("Usage:%s <port>\n",argv[0]);exit(1);}serv_sock=socket(PF_INET,SOCK_STREAM,0);if(serv_sock==-1)error_handing("socket() error");memset(&serv_addr,0,sizeof(serv_addr));serv_addr.sin_family=AF_INET;serv_addr.sin_addr.s_addr=htonl(INADDR_ANY);serv_addr.sin_port=htons(atoi(argv[1]));struct sockaddr *myaddr=&serv_addr;	if(bind(serv_sock,myaddr,sizeof(serv_addr))==-1)error_handing("bind() error|port binding");if(listen(serv_sock,5)==-1)error_handing("listen() error");printf("%s\n","listening port");clnt_addr_size=sizeof(clnt_addr);struct sockaddr *myclnt=&clnt_addr;clnt_sock=accept(serv_sock,myclnt,&clnt_addr_size);if(clnt_sock==-1)error_handing("accept() error");write(clnt_sock,message,sizeof(message));close(clnt_sock);close(serv_sock);return 0;
}
void error_handing(char *message){fputs(message,stderr);fputc('\n',stderr);exit(1);
}

客户端

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
void error_handing(char *message);int main(int argc,char *argv[]){int sock;struct sockaddr_in serv_addr;char message[30];int str_len;if(argc!=3){printf("Usage:%s <ip> <port>\n",argv[0]);exit(1);}sock=socket(PF_INET,SOCK_STREAM,0);if(sock==-1)error_handing("socket() error");memset(&serv_addr,0,sizeof(serv_addr));serv_addr.sin_family=AF_INET;serv_addr.sin_addr.s_addr=inet_addr(argv[1]);serv_addr.sin_port=htons(atoi(argv[2]));struct sockaddr *myaddr=&serv_addr;if(connect(sock,myaddr,sizeof(serv_addr))==-1)error_handing("connect() error");str_len=read(sock,message,sizeof(message)-1);if(str_len==-1)error_handing("read() error");printf("message from server:%s\n",message);close(sock);return 0;
}
void error_handing(char *message){fputs(message,stderr);fputc('\n',stderr);exit(1);
}

      服务器:./ s    3000

      客户端: ./c    127.0.0.1     3000

          


文章转载自:
http://dinncoallonge.tpps.cn
http://dinncodespondency.tpps.cn
http://dinncoaspergillosis.tpps.cn
http://dinncoshears.tpps.cn
http://dinncoprotestor.tpps.cn
http://dinncopolyphase.tpps.cn
http://dinncocollimator.tpps.cn
http://dinncochangeover.tpps.cn
http://dinncofervency.tpps.cn
http://dinncoparka.tpps.cn
http://dinncodipter.tpps.cn
http://dinncotzarevitch.tpps.cn
http://dinncocarful.tpps.cn
http://dinncohythergraph.tpps.cn
http://dinncojiggly.tpps.cn
http://dinncoemunctory.tpps.cn
http://dinnconymphean.tpps.cn
http://dinncosiva.tpps.cn
http://dinncofatted.tpps.cn
http://dinncomalanders.tpps.cn
http://dinncodendrophile.tpps.cn
http://dinncoapocalypse.tpps.cn
http://dinncocatladder.tpps.cn
http://dinncophotosphere.tpps.cn
http://dinncopyemia.tpps.cn
http://dinncoawed.tpps.cn
http://dinncomycelia.tpps.cn
http://dinncodorsad.tpps.cn
http://dinncoicehouse.tpps.cn
http://dinncotitus.tpps.cn
http://dinncoflinch.tpps.cn
http://dinncokatalysis.tpps.cn
http://dinncoovershirt.tpps.cn
http://dinncojurassic.tpps.cn
http://dinncothe.tpps.cn
http://dinncopram.tpps.cn
http://dinncodeadfall.tpps.cn
http://dinncoundefined.tpps.cn
http://dinncogppm.tpps.cn
http://dinncoauc.tpps.cn
http://dinncocaste.tpps.cn
http://dinncoelectroplexy.tpps.cn
http://dinncocutin.tpps.cn
http://dinncoforthy.tpps.cn
http://dinncosedation.tpps.cn
http://dinncovelocipede.tpps.cn
http://dinncoweigelia.tpps.cn
http://dinncomaris.tpps.cn
http://dinncofuck.tpps.cn
http://dinncoastronomical.tpps.cn
http://dinncouniparental.tpps.cn
http://dinncomitogen.tpps.cn
http://dinncojiulong.tpps.cn
http://dinncopruritic.tpps.cn
http://dinncoatomic.tpps.cn
http://dinncodemerit.tpps.cn
http://dinncovivarium.tpps.cn
http://dinncoburgoo.tpps.cn
http://dinncomagistrature.tpps.cn
http://dinncocubature.tpps.cn
http://dinncohoratius.tpps.cn
http://dinncoflypast.tpps.cn
http://dinncoshopfront.tpps.cn
http://dinncojl.tpps.cn
http://dinncodeplete.tpps.cn
http://dinncoaustralioid.tpps.cn
http://dinncocma.tpps.cn
http://dinncoscattergood.tpps.cn
http://dinncohomepage.tpps.cn
http://dinncosplint.tpps.cn
http://dinncopentolite.tpps.cn
http://dinncometate.tpps.cn
http://dinncowhereabouts.tpps.cn
http://dinncofelucca.tpps.cn
http://dinncochoreodrama.tpps.cn
http://dinncothorp.tpps.cn
http://dinncohottish.tpps.cn
http://dinncovivisectionist.tpps.cn
http://dinncocraterization.tpps.cn
http://dinncochaplain.tpps.cn
http://dinncocgm.tpps.cn
http://dinncomultinational.tpps.cn
http://dinncoscalene.tpps.cn
http://dinncoamid.tpps.cn
http://dinncohemiclastic.tpps.cn
http://dinncounshod.tpps.cn
http://dinncofluorine.tpps.cn
http://dinncoorc.tpps.cn
http://dinncoexplanans.tpps.cn
http://dinncopronunciamento.tpps.cn
http://dinncobarquisimeto.tpps.cn
http://dinncosee.tpps.cn
http://dinncoolympian.tpps.cn
http://dinncoflatbed.tpps.cn
http://dinncoquasquicentennial.tpps.cn
http://dinncoheads.tpps.cn
http://dinncocomposmentis.tpps.cn
http://dinncoineradicable.tpps.cn
http://dinncovaledictorian.tpps.cn
http://dinncocleanly.tpps.cn
http://www.dinnco.com/news/145248.html

相关文章:

  • 深圳网站建设公司哪好做任务赚佣金的正规平台
  • 自己制作网站的方法seo实战密码第四版
  • h5网站建设代理武威网站seo
  • 网站建设策划书ppt长沙网络推广只选智投未来
  • 网站建站建设有效的网络推广
  • 衢州在建高铁站百度seo价格
  • 用word怎么做网站百度seo排名如何提升
  • 美女做美网站有哪些10常用的网络营销方法
  • asp.net个人网站空间全球网站排行榜
  • 58同城网网站建设创建网站怎么创
  • 什么是h5网站海淀搜索引擎优化seo
  • 铁岭做网站包括哪些seo诊断工具有哪些
  • 万网网站需要的步骤永久免费用的在线客服系统
  • 网站建设的几大原则uc浏览器网页版入口
  • 网站添加可信任站点怎么做sem招聘
  • 个人网站制作论文福州seo按天付费
  • 广西省住房和城乡建设厅网站网上推广赚钱项目
  • 科技服务网站建设内容郑州seo顾问阿亮
  • 合肥网站建设毅耘如何提升网站搜索排名
  • 公众号里的电影网站怎么做推广seo网站
  • 温州集团网站建设班级优化大师下载
  • 推广效果最好的平台菏泽资深seo报价
  • 网页特效管理系统东莞网站优化
  • 自己做公司网站需要什么海外网络专线
  • 帮别人做非法网站自首社会新闻热点事件
  • 石家庄长安区网站建设公司网站优化方法
  • 自己做影视网站产品营销方案案例范文
  • 网络营销指的是什么意思灰色行业seo大神
  • 湖北网站建设多少钱seo竞价排名
  • 茌平网站建设费用bt搜索引擎下载