Here is the code,
It won't compile and there is a compiler error "cannot convert parameter 1 from 'char [100]' to 'char *&' ". Why?Code:void foo(char*& s) { for(int i=0;i<10;i++) *s++ = '0'+i; *s = '\0'; } int main() { char s[100]; foo(s); return 0; }




Reply With Quote