#include <stdio.h>
#include <string.h>
void removeLeadingZeros(char *str) {
int i = 0, j = 0;
int len = strlen(str);
// Find the index of the first non-zero character
while (i < len && str[i] == '0') {
i++;
}
// Shift all characters to the left
while (i < len) {
str[j++] = str[i++];
}
str[j] = '\0';
// If the string was all zeros
if (j == 0) {
str[0] = '\0';
}
}
int main() {
char str[] = "000345865.9301";
removeLeadingZeros(str);
printf("%s\n", str);
return 0;
}
/*
run:
345865.9301
*/