C语言小问题解决方案(持续更新)

1:C语言中运行时怎么一闪就过去了,看不到运行界面啊

   答:在结束前加getch().

2: stdlib.h有何作用?

答:   

  头文件里包含了C语言的一些函数 

 该文件包含了的C语言标准库函数的定义  stdlib.h里面定义了五种类型、一些宏和通用工具函数。类型例如size_twchar_t、div_t、ldiv_t和lldiv_t;宏例如EXIT_FAILUREEXIT_SUCCESSRAND_MAX和MB_CUR_MAX等等;常用的函数如malloc()、calloc()、realloc()、free()()、system()、atoi()、atol()、rand()()、 srand()()、exit()等等。 具体的内容你自己可以打开编译器的include目录里面的stdlib.h头文件看看。  conio.h  conio.h不是C标准库中的头文件。  conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()()函数等等。  包含的函数  cgets(char *);  cprintf(const char *, ...);  cputs(const char *);  cscanf(const char *, ...);  inp(unsigned short);  inpw(unsigned short);  getch()(void);  getch()e(void);  kbhit(void);  outp(unsigned short, int);  outpw(unsigned short, unsigned short);  putch(int);  ungetch(int);  void _Cdeclclreol (void);  void _Cdeclclrscr (void);  void _Cdecl delline (void);  int _Cdeclgettext (int left, int top, int right, int bottom,  void *destin);  void _Cdeclgettextinfo (struct text_info *r);  void _Cdeclgotoxy (int x, int y);  void _Cdeclhighvideo (void);  void _Cdeclinsline (void);  void _Cdecllowvideo (void);  int _Cdeclmovetext (int left, int top, int right, int bottom,  int destleft, int desttop);  void _Cdeclnormvideo (void);  int _Cdeclputtext (int left, int top, int right, int bottom,  void *source);  void _Cdecltextattr (int newattr);  void _Cdecltextbackground (int newcolor);  void _Cdecltextcolor (int newcolor);  void _Cdecltextmode (int newmode);  int _Cdeclwherex (void);  int _Cdeclwherey (void);  void _Cdecl window (int left, int top, int right, int bottom);  har *_Cdeclcgets (char *str);  int _Cdeclcprintf (const char *format, ...);  int _Cdeclcputs (const char *str);  int _Cdeclcscanf (const char *format, ...);  int _Cdecl getch (void);  int _Cdeclgetche (void);  char *_Cdeclgetpass (const char *prompt);  int _Cdeclkbhit (void);  int _Cdecl putch (int c);  int _Cdeclungetch(int ch);


3:C语言中scanf后面,什么情况下不加符号&?

答:scanf("",&a);双引号里面是格式模式,就是说你要输入的数字或字符等格式,然后是存放到a里面,这里的&是取地址符号,指针说白了也是地址,还有数组名也是地址,所以只要是地址的都不用加&,其他的要加,你可以多去看点代码,自然而然你就会懂得了。

4:常用打开文件的方法!!

答:if((fp=foper("file1","r"))==NULL)

printf("cannot open this file\n");

exit(0);

}





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章