Question: How do i create a four byte unicode (an emoji in this case) from a integer created by the rand() function? In C plz. //

How do i create a four byte unicode (an emoji in thisHow do i create a four byte unicode (an emoji in this case) from a integer created by the rand() function? In C plz.

// Return a random emoji stored in new heap memory you have allocated. char *emoji_random_alloc() { // return ""; char* out = malloc(100); // creating a random integer between 126976 (=17000) // and 129535 (=129535) int tmp rand() % 2559 + 126976; printf("tmp %d in decimal %x in hex ", tmp, tmp); strcpy(out, tmp); return out; } // Return a random emoji stored in new heap memory you have allocated. char *emoji_random_alloc() { // return ""; char* out = malloc(100); // creating a random integer between 126976 (=17000) // and 129535 (=129535) int tmp rand() % 2559 + 126976; printf("tmp %d in decimal %x in hex ", tmp, tmp); strcpy(out, tmp); return out; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!