[Solved] How this C code works?


Beware that this code, as is, contains errors: bad cast, undefined behavior and platform dependent results…

This is pointer arithmetic. w initially points to the content at the address of the first element of t (this is what w = (unsigned short *)&t means). Then, hereafter, you access this memory as containing successives shorts. At the same time the pointer is moved from a short to its successor.

3

solved How this C code works?