Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c programming itoa() example

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main()
{
    int a=54325;
    char buffer[20];
    itoa(a,buffer,2);   // here 2 means binary
    printf("Binary value = %s
", buffer);
 
    itoa(a,buffer,10);   // here 10 means decimal
    printf("Decimal value = %s
", buffer);
 
    itoa(a,buffer,16);   // here 16 means Hexadecimal
    printf("Hexadecimal value = %s
", buffer);
    return 0;
}
Source by fresh2refresh.com #
 
PREVIOUS NEXT
Tagged: #programming
ADD COMMENT
Topic
Name
5+2 =