啊哈磊_编程从这里起步

标题: 为什么不能运行? [打印本页]

作者: nana111    时间: 2013-12-24 22:13
标题: 为什么不能运行?
  1. #include<stdio.h>
  2. #include<string.h>
  3. void main()
  4. { char *s;
  5.   char c;
  6.   s=&c;
  7.   printf("which style do you want to:\n");
  8.   printf("Capital (c) or uncapital (a):");
  9.   c=getchar();
  10.   if(c='c') strcpy(s,"COMPUTER");
  11.   else strcpy(s,"computer");
  12.   puts(s);
  13. }

复制代码


作者: 超神级    时间: 2013-12-24 23:31
6行S是地址
作者: 4399APPLE    时间: 2013-12-25 09:32
永远不要写void main
作者: 4399APPLE    时间: 2013-12-25 09:32
永远不要写void main




欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/) Powered by Discuz! X3.2