What is the meaning of "&"? Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
zhengyang0512
Member++
Posts: 27
Joined: Tue Aug 23, 2016 6:14 am

What is the meaning of "&"?

Post by zhengyang0512 »

I have seen the symbol "&" many times, so whether is it the same use of "&" in C languages? We all know it was one of the use of pointer in C.

Code: Select all

        select {
            case i_debug_if.get_counts (unsigned int& index_, long signed& sample_):
                index_ = index;
                sample_ = sample;
            break;

        }


View Solution
henk
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Hi zhengyang,

It means that this parameter is passed by reference, i.e., you can call

Code: Select all

get_counts(x,y)
without '&' and both x and y will be overwritten by the call. It is the same as defining the parameter with a '*' and calling it with an '&'.

Cheers,
Henk
User avatar
zhengyang0512
Member++
Posts: 27
Joined: Tue Aug 23, 2016 6:14 am

Post by zhengyang0512 »

henk wrote:Hi zhengyang,

It means that this parameter is passed by reference, i.e., you can call

Code: Select all

get_counts(x,y)
without '&' and both x and y will be overwritten by the call. It is the same as defining the parameter with a '*' and calling it with an '&'.

Cheers,
Henk
Thank you!
Post Reply