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 emojirandomalloc function. I think I completed the emojicount function and so I think I need to possibly use that to update the emojirandomalloc function? If it's not working, please update both functions provided and if emojicount is not needed, then please update just the emojirandomalloc function.
The project page says:
In emojirandomalloc, 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 emojirandomalloc is called.
Just like in emojicount, you can assume the inclusive range UF UFAFF or be more specific.
Here's my code:int emojirangeuintt codepoint
return codepoint && codepoint ;
Count the number of emoji in the UTF string 'utfstr returning the count. You should
consider everything in the ranges starting from and including UF up to and including UFAFF.
int emojicount const unsigned char utfstr
int count ;
int bytestoread ;
uintt codepoint ;
while utfstr
unsigned char byte unsigned charutfstr;
if bytestoread
if byte
codepoint byte;
else if byte
codepoint byte & xF;
remainingbytes ;
else if byte
codepoint byte &;
remainingbytes ;
else if byte
codepoint byte &;
remainingbytes ;
else
do nothing
else
if byte
codepoint codepoint byte & OXF;
else
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
