ESQL/C Type error
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, I am getting a 'type error' when I try to compile - fragment is pasted below. ... long (*hp_sltagval[NSLTAGVALELEMNTS]); if ((hp_sltagval = (long *)calloc(NSLTAGVALELEMNTS,sizeof(long)) == NULL) /* TYPE ERROR */ ... I have also tried to change the type casting to (*[]) but did not work. Thanks, Sunil
Sunil Bhaskarla wrote: > I am getting a 'type error' when I try to compile - fragment is pasted below. > > ... > long (*hp_sltagval[NSLTAGVALELEMNTS]); > if ((hp_sltagval = (long *)calloc(NSLTAGVALELEMNTS,sizeof(long)) == NULL) /* TYPE ERROR */ > ... > > I have also tried to change the type casting to (*[]) but did not work. Well, whatever else it is, hp_sltagval is not a 'long *'! I reserve the right to be wrong, but I think the parentheses are redundant and hp_sltagval is an array of pointers to long. Given what you've written in the calloc() statement, I think you simply need: long *hp_sltagval; Otherwise, you need to rethink what you are doing extremely carefully. Remember, an array name is not a modifiable l-value (and you are currently trying to modify an array name). -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.95 -- see http://www.perl.com/CPAN #include <disclaimer.h>