Am I doing this right? This particular code corresponds to Spy Life Coding Challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Am I doing this right? This particular code corresponds to Spy Life Coding Challenge

https://code.sololearn.com/ckXvp2kTbWJE/?ref=app The built in compiler says my program has some errors in it so, can someone please enlighten me of how should my program work and also a way to allow whitespaces as part of the program as well? Thank you!

17th Mar 2021, 3:21 AM
Marc Stephen Gabres
Marc Stephen Gabres - avatar
1 Answer
0
Marc Stephen Gabres malloc() function is used for allocation of memory, malloc allocates memory from heap. It doesn't initialise memory with zero program needs null ('\0') character at the end of string data otherwise it will print garbage value at end of the string till null ('\0') character appears while printing using printf() function DHANANJAY
17th Mar 2021, 3:35 AM
DHANANJAY PATEL
DHANANJAY PATEL - avatar