Question

I want to assign something to a variable like this:

rtpArray[bn].ts06_timestamp = rtpArray[bn].timestamps_shm_ptr_aux[SCPAD_TS06];

The thing is, rtpArray[bn].ts06_timestamp this is of a type called utdc_samples that is bigger than char, and rtpArray[bn].timestamps_shm_ptr_aux is an array of char.

My question is, will this work?

Était-ce utile?

La solution

If rtpArray[bn].timestamps_shm_ptr_aux is an array of chars, then rtpArray[bn].timestamps_shm_ptr_aux[SCPAD_TS06] is a single char value. There's no reason why you can't assign this to a larger integer type.

Autres conseils

It's hard to be sure about this, since you don't show the complete declarations that your code is using.

You are indexing on the right hand side, which implies that the result of the right hand size is a single character, i.e. a small integer. Assuming that utdc_samples is also an integer type, but larger than a char, then the assignment is fine.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top