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?

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top