Does this program efficient enough? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Does this program efficient enough?

In this code i use 2 additional header other than <stdio.h>. My question is does the additional header is needed in the code or this code could be made with fewer header? https://sololearn.com/compiler-playground/cfWArdOmniFD/?ref=app Btw the code is running and i just want to know other alternative to solve this.

16th Dec 2023, 4:57 PM
Celvien Kurniawan
Celvien Kurniawan - avatar
2 Answers
+ 5
Yes. Additional headers are needed as -> string.h for strlen() function to work well.. -> ctype.h for isdigit() function to work well.. Yes. You can write code without using those headers.. Use just for(int i=0; a[i] ; i++) as loop header.. Also if( a[i] >= '0' && a[i]<= '9' ) as if condition.. There may be other ways..
16th Dec 2023, 5:29 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna 🇮🇳 's suggestions are great. you can implement your own strlen and isdigit functions https://sololearn.com/compiler-playground/cPC7ouCp2lvK/?ref=app
17th Dec 2023, 4:23 AM
Bob_Li
Bob_Li - avatar