I\'m sort of out of my depths here, but I have the following code (the real code actually has a point of course):
- (NSData*) dataTheseBytes:(Byte[]) bytes {
When you pass a C array as a method or C function argument, it "decays" to a pointer to the underlying type (i.e. Byte[]
is actually passed as Byte *
.) So the called method/function has no idea how many elements are present in the array.
You must also pass the length of the array in order for the called code to know what you want. That's why +[NSData dataWithBytes:length:]
has that second argument.