void refarray(char * &arraybuff[])
{
char *s1="hello";
char *s2="everybody";
arraybuff[0]=s1;
arraybuff[0]=s2;
}
void main()
{
char* getarray[2];
refarray(&getarray[]);
printf("%s %s",getarray[0],getarray[1]);
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 28, 2012, 8:16 AM EDT
void refarray(char *arraybuff[])
{
char *s1="hello";
char *s2="everybody";
arraybuff[0]=s1;
arraybuff[1]=s2;
}
void main()
{
char *getarray[2];
refarray(getarray);
printf("%s %s",getarray[0],getarray[1]);
}
As expected, the output is:
hello everybody