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);

}





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