+ 2
Input in the same line in C
This ( https://code.sololearn.com/cg41nmxdEzQP/#c ) is my simple input program. I tried something like a "form", where the output syntax looks like: ------------------------------------ <message> : <user-input> <another-message> : <result> ------------------------------------ But, my code isn't working. What is the reason behind it? And, how can I get my desired "form" output?
1 Answer
+ 1
1. Add library #include<stdlib.h> at the beginning
2. Allocate memory for your string name.
char* name = malloc(256);
3. If you want free memory using free(name);