[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: something about ldap_add_s



kdrjy@263.net wrote:

Ummm, I haven't the patience to look very deep, but the first two lines
of your code both have the same serious problem:
> 
>  char            *ch_value1[]=ch_value2[]=ch_value3[]={NULL,NULL};
>  LDAPMod         *attr[4],attr1,attr2,attr3;

The * to declare a pointer associates with the name, not the type.  I
think you want something more like:

char	*ch_value1[] = {NULL, NULL};
char	*ch_value2[] = {NULL, NULL};
char	*ch_value3[] = {NULL, NULL};
LDAPMod	*attr[4];
LDAPMod	*attr1;
LDAPMod	*attr2;
LDAPMod	*attr3;

The significant point is the number of stars, and that's one of the
reasons why many of us prefer to put each declaration on a separate
line.

Well, I don't know if you really mean for attr1, attr2, and attr3 to be
pointers, but you certainly can't initialize ch_value1, an array of
pointers, from ch_value2, an array of char.