Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[4886] malloc()에 대한 질문입니다.
한성현 [] 1280 읽음    2005-01-18 14:24
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define LINE 81
#define MAX 100

void main()
{
    char temp[LINE];
    char *ps[MAX];
    int index=0;
    int count;
    char *malloc();

    puts("Name some anything.");
    puts("Enter them ont at a time; [enter] at the start");
    puts("of a line to end your list. Okay, I'm ready.");

    while(index<MAX && gets(temp)!=0 && temp[0]!='\0')
    {
        if((ps[index] = malloc (strlen(temp)+1))==NULL)  // Extra parameter in call to malloc()
        {
            printf("Out of Memory \n");
            exit(0);
                }
        strcpy(ps[index],temp);
        if(++index<MAX)
            printf("That's %d, Continue.\n",index);
    }

    puts("Okay, here is what I've got.");
    for(count=0; count<index;count++)
        puts(ps[count]);
}

이상하게도 malloc()함수만 들어가면 Extra parameter call 에러가 납니다.
터보씨 3.1윈도우용 버전이고 윈도우 xp 입니다..

ps[index]=malloc(strlen(temp)+1);

이문장이 잘못된건가여??
가르침 부탁드립니다~~

+ -

관련 글 리스트
4886 malloc()에 대한 질문입니다. 한성현 1280 2005/01/18
4888     Re:malloc()에 대한 질문입니다. 레인싱어 1553 2005/01/19
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.