zoukankan      html  css  js  c++  java
  • c语言指针点滴1

    
    
     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 
     4 void main()
     5 {
     6     int *p = NULL;//指针开始最好都初始化为空
     7     if(p == NULL)
     8     {
     9         printf("妹子p现在是单身 可以疯狂的进攻");
    10     }else
    11     {
    12         printf("妹子p不是单身 请慎重考虑");
    13     }
    14     //printf("%d",*p);//不合法0x000000操作系统使用 不可以随便玩 
    15 
    16     getchar();
    17 }
    
    
    
     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 
     4 void main1()
     5 {
     6     int num = 100;
     7     int *p;//error 使用了未初始化的局部变量
     8     //在一些c++编译器里面 不检查变量的初始化,指针使用之前必须初始化
     9     //p = num;//相对于把100的地址给了p  可以编译不能运行
    10     p = &num;
    11     printf("%d",*p);
    12     printf("%x",&p);
    13 
    14 
    15     getchar();
    16 }
     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 
     4 void main4()
     5 {
     6     double a = 1,b=2,c=3;//double8个字节
     7     //double *pa,pb,pc;//指针四个字节 pa是指针 
     8     double *pa,*pb,*pc;
     9     printf("%d%d%d",sizeof(pa),sizeof(pb),sizeof(pc));
    10 }
  • 相关阅读:
    字典-dict
    队列-deque
    with-as 语句
    odoo 在"动作"("Action")菜单中添加子菜单, 点击子菜单弹窗自定义form
    odoo onchange readonly
    pyhton 连接 oracle
    PyCharm WSL 配置
    docker 安装 oracle
    docker 安装 mssql
    odoo =like
  • 原文地址:https://www.cnblogs.com/lanjianhappy/p/5960043.html
Copyright © 2011-2022 走看看