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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -