[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: why is this code here?



>> preventry is set to NULL at the top, strdup("") just sets it to NULL again. 
>> What am I missing????
> 
>   Huh?  Unless the semantics of C strings have changed underneath me,
> strdup("")
> sets it to *a pointer to* a NULL byte.  This is important, since otherwise
> you'll segfault when you try to access strdup..assuming that inputBox doesn't
> treat NULL strings as "".
> 

assuming that inputbox really won't read NULL, why not simply do 'preventry =
"";'???


Reply to: