Which is the fastest way to get a slice of an array in c? -
i this:
char in[] = {'a','b','c','d','f','r','t','b','h','j','l','i'}; char out[3]; out = ∈ and first 3 characters
but error of incompatible types
out array name, can't modified. there's no straight forward way slice of array in c. can use memcpy:
memcpy(out, in, sizeof out); and need take in has sufficient elments copy from.
Comments
Post a Comment