Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int * convert ( int iNumber, int iBase )
- {
- int * cResult = malloc(sizeof(int)*sizeof(int));
- int iCompteur = 0;
- if ( cResult != NULL )
- {
- while ( iNumber != 0 ) {
- cResult[iCompteur] = iNumber % iBase;
- iNumber = iNumber / iBase;
- iCompteur++;
- }
- //iCompteur = iCompteur - 1;
- //int p = cResult;
- //while ( iCompteur >= 0 ) {
- //p = cResult[iCompteur];
- //printf("%d", p);
- //iCompteur--;
- //}
- }
- return cResult;
- }
- int main (int argc, const char * argv[])
- {
- // insert code here...
- int iNumbre = convert(2,2);
- printf("%d", iNumbre);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement