PHP Code:
struct Info {
char *name;
char **value;
};
and a function
PHP Code:
void addValue(struct Info *info,char *value ,int posVal)
{
int size=strlen(value)+1;
info->value[posVal]= (char *)malloc(size);
strcpy(info->value[posVal],value);
info->value[posVal+1]=NULL;
}
Main
PHP Code:
struct Info info[10]
.......
.......
PHP Code:
[LEFT]initValArrSize(&info[0],1);
/*
Make size+1 single dimension arrays of size char *
void initValArrSize(struct XMLInfo *info, int size )
{
info->value=(char **)malloc((size+1)*sizeof(char *));
}
*/
[/LEFT]
now calling addvalue
PHP Code:
addValue(&info[0],"Inspiron", 0);
I want to change it to info[0].value[0] so that it reduces the number of arguments in addValue method and also pass it by reference so that changes are reflected in main
ex .
PHP Code:
addValue(info[0].value[0],"Inspiron");
Please suggest the addValue definition to accommodate this change


