문제

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