Returning arrays
#1

Hello,

is it possible to return string longer than 256 characters with a function? I tried even to put that string as a reference, but variable can't be both an array and a reference. I need this to update large strings with a function.

Thanks in advance,
niCe
Reply
#2

Array cannot mark as an reference because it's already an reference.
So u can do:
Code:
new 
  test[999];
test1(t[]){
  t[sizeof(t)-1] = 'h';
}
In addition, return value can be any legal lenth.
Reply
#3

Ah so, I didn't know arrays are defaultly passed as a reference. Thanks!
Reply
#4

With first method, you don't need to add '&', array is already pass as an reference.

With secomd method, I guess u're using strtok.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)