- 7

Anybody please send me the code for the challenge camel to snake in c

Challenge: camel string case into snake case

25th Oct 2022, 3:53 PM
Arsh Abbas
Arsh Abbas - avatar
4 Answers
+ 7
Arsh Abbas , we will not send you a ready-made code for this code coach exercise. but we may help you, if you show us the attempt you have don, also give us a description about the issues you are faced with.
25th Oct 2022, 5:04 PM
Lothar
Lothar - avatar
+ 1
#include<stdio.h> #include<string.h> #include<ctype.h> void main(){ char input[50]; int i,j,index; scanf("%[^\n]",input); for(i = 0;i < strlen(input);i++){ for(j = 65;j <= 90;j++){ if(input[i] == (char)j){ input[i] = tolower(input[i]); index = i; for(i = strlen(input);i >= index; i--){ input[i+1] = input[i]; } input[index] = '_'; break; } } } puts(input); }
25th Oct 2022, 5:08 PM
Arsh Abbas
Arsh Abbas - avatar
0
All test cases passed except last one.
25th Oct 2022, 5:07 PM
Arsh Abbas
Arsh Abbas - avatar
0
Please Check for any bug in my code.
26th Oct 2022, 11:42 AM
Arsh Abbas
Arsh Abbas - avatar