Question: Hello could someone please help me with C code? I need to figure out the emoji _ random _ alloc function. I think I completed

Hello could someone please help me with C code?
I need to figure out the emoji_random_alloc function. I think I completed the emoji_count function and so I think I need to possibly use that to update the emoji_random_alloc function? If it's not working, please update both functions provided and if emoji_count is not needed, then please update just the emoji_random_alloc function.
The project page says:
In emoji_random_alloc, you will generate a random emoji each time the function is called! The official manual page rand outlines how to create a random integer in C, which youll need to use for your emoji. Make sure that you return a different emoji each time emoji_random_alloc is called.
Just like in emoji_count, you can assume the inclusive range U+1F000- U+1FAFF or be more specific.
Here's my code:int emoji_range(uint32_t code_point){
return (code_point 01F000 && code_point );
}
// Count the number of emoji in the UTF-8 string 'utf8str', returning the count. You should
// consider everything in the ranges starting from (and including) U+1F000 up to (and including) U+1FAFF.
int emoji_count (const unsigned char *utf8str){
int count =;
int bytes_to_read =;
uint32_t code_point =;
while (*utf8str
unsigned char byte =(unsigned char)(*utf8str);
if (bytes_to_read ==){
if (byte 07F){
code_point = byte;
} else if ((byte >5)=06){
code_point = byte & 0x1F;
remaining_bytes =1;
} else if ((byte >4)==0xE
code_point = byte &xF;
remaining_bytes =2;
} else if ((byte >>3)==01E
code_point = byte &07;
remaining_bytes =3;
} else {
// do nothing
}
} else {
if byte 6
code_point code_point 6(byte & OX3F);
} else {
 Hello could someone please help me with C code? I need

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!