Coder's Guild Mailing List

Re: Hasan

Posted by Emre Yucel on 1999-09-29

Adam Moss... you seem to have forgotten something. You can't use a pointer 
which is not pointing to something. If you want to do that, you first need 
to allocate a string of chars, and make your char*c point to that. at the 
end of the program, you need to de-allocate the memory, if you want to be a 
good programmer. I think the simplest way, is just making c an array of 
chars instead of one char or pointer to char(s).

At 06:15 PM 9/29/99 +0200, you wrote:
>{
>    char *c;
>    int i;
>
>    printf("please enter the name");
>    for (i=0;c(i)!='\n';i++)
>    {
>     c(i)=getchar();
>    }
>    printf("your name is %s and has %d
>characters",c,i);
>}

--
Emre Yucel
http://www.tiac.net/users/amoeba/ mailto:amoeba@xxxx.xxx

"They have computers, and they may have other weapons of mass destruction." 
-- Janet Reno, US Attorney General, 2/27/98