given : int x[3] = {11,22,33}; how can save it as a key's value as binary data and get it
the hiredis give example to how to set binary safestring
/* Set a key using binary safe API */
reply = redisCommand(c,"SET %b %b", "bar", (size_t) 3, "hello", (size_t) 5);
printf("SET (binary API): %s\n", reply->str);
freeReplyObject(reply);
but how about other data and how to get ?
Storing directly binary data in a remote store without any kind of marshalling is a recipe for disaster. I would not recommend to do it: there are plenty of serialization protocols you could use to make binary data independent from the platform.
That said, to answer your question:
Note that this kind of code only works if you are sure that all your Redis clients run on systems with the same endianness and same sizeof(int).