首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

exit(1); /*这里什么意思*/,该如何解决

2012-02-12 
exit(1)/*这里什么意思*/#includestdio.h#includestdlib.h#defineNULL0main(){int*p,*tableintsize

exit(1); /*这里什么意思*/
#include   <stdio.h>
#include   <stdlib.h>
#define   NULL   0
main()
{
  int   *p,*table;
  int   size;
  printf( "\nWhat   is   the   size   of   table? ");
  scanf( "%d ",&size);
  printf( "\n ");

    if   ((table=(int   *)   malloc(sizeof(int)))   ==NULL)/*分配出来的内存的第一个地址
    赋给类型为int的指针table*/
      {
        printf( "No   space   available   \n ");
        exit(1);       /*这里什么意思*/
        }
    printf( "\n   Address   of   the   first   byte   is   %u\n ",table);
    printf( "\nInput   table   values   \n ");

      for   (p=table;p <table+size;p++)
          scanf( "%d ",p);

        for   (p=table+size-1;p> =table;p--)
          printf( "%d   is   stored   at   address   %u\n ",*p,p);
          system( "pause ");
          clrscr();

[解决办法]
exit(1); /*这里什么意思*/
退出程序
[解决办法]
exit(1); /*这里什么意思*/
退出程序, 1表示有错误, 本程序中表示内存分配失败
[解决办法]
exit(0); 表示正常推出。 相当于return 语句
exit(a);a> 0表示,因为发生了某种错误而退出。

热点排行