Hello!
I'm having some trouble understanding how arrays are passed.
From my understanding, my code here passes a pointer to the first element of the blah array, which is "var1=5".
My question then is how can I move to the next element of my blah array, "var2=234234" in my filevars() function?
#define length(a) (sizeof (a) / sizeof *(a))
void filevars(const char *blah);
void filevars ( const char *blah )
{
int i;
for(i=0;i<length(blah);i++){
printf("%s", &blah[i]);
}
}
main(){
char *blah[] = {
"var1=5",
"var2=234234"
};
filevars(*blah);
}
Thanks so much!