zoukankan      html  css  js  c++  java
  • C语言随笔_类型声明

    有位同学说,“老师,我运行如下代码,结果报错了”

     #include <iostream.h>

    int main(){
    char c, 
    int b;
    return 0;
    }
    报错结果是:
    --------------------Configuration: Test - Win32 Debug--------------------
    Compiling...
    demo.c
    d:ccode estdemo.c(4) : error C2059: syntax error : 'type'
    Error executing cl.exe.

    demo.obj - 1 error(s), 0 warning(s)

    这位同学不知道错在哪里。

    其实是错在 
    char c,  int b;了。声明变量c后,紧接着声明变量b,此时变量c后是不能写逗号的,要写分号才行。
    可能这位同学的作文水平比较好,逗号、句号用的比较溜。可是计算机代码可不像写作文呀,声明完一种类型的变量后,一定要以分号结尾哦。 
     
  • 相关阅读:
    bom案例2-弹出层
    bom案例1-div拖拽
    bom-scroll
    bom-client
    bom-offset
    9. 阻塞队列
    8. 读写锁
    7. CountDownLatch、CyclicBarrier、Semaphore
    6. Callable
    5. 集合不安全
  • 原文地址:https://www.cnblogs.com/itblog/p/7236655.html
Copyright © 2011-2022 走看看