Created
July 8, 2015 18:35
-
-
Save lmansur/7719ad505a57f63e988c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* fti(float num) //função que converte o float de entrada em string | |
{ | |
Uint32 n1=0; | |
Uint32 n2=0; | |
Uint32 n3=0; | |
Uint32 n4=0; | |
char c1,c2,c3,c4; | |
n1= num/10; | |
n2= (num-(n1*10))/1; | |
n3 = ((num*10-n1*100-n2*10))/1; | |
n4=(num*100-n1*1000-n2*100-n3*10)/1; | |
c1 = n1 + 48; | |
c2 = n2 + 48; | |
c3 = n3 + 48; | |
c4 = n4 + 48; | |
char *s; | |
s = malloc( 6 * sizeof (char)); | |
s[0] = c1; | |
s[1] = c2; | |
s[2] = '.'; | |
s[3] = c3; | |
s[4] = c4; | |
s[5] = '\0'; | |
return(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment