ITOA function usage

Source: Internet
Author: User

Char * ITOA (INT value, char * string, int Radix)

Parameters (parameter description)
Value: number to be converted (value to be converted)
String: String result (Conversion Result)
Radix: Base of value; must be in the range 2-36
(Conversion base, value range: 2-36. For example, Radix = 10 indicates the base-10 format, and Radix = 8 indicates the base-8 format .)

Return Value: Same as the string parameter, which facilitates nested function calls.

Example

# I nclude <stdlib. h>
# I nclude <stdio. h>

Void main (void)
{
Char buffer [20];
Int I = 1234;

ITOA (I, buffer, 10 );
Printf ("string of integer % d (Radix 10): % s/n", I, buffer );
ITOA (I, buffer, 16 );
Printf ("string of integer % d (Radix 16): 0x % s/n", I, buffer );
ITOA (I, buffer, 2 );
Printf ("string of integer % d (Radix 2): % s/n", I, buffer );
}
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.