C language realizes the string of characters and numbers together

Time:2022-5-4

C language is a relatively low-level language. All data is represented by data structures such as integers, floating-point numbers, arrays and pointers.

In contrast, the conversion between data types in higher-level languages is more free.

After all, different languages have different design purposes.

In C language, the sprintf function can be used to string integer or other types of metaclass data into a string.

The first parameter of sprintf function is the output string, and the second is a format string, format description. Insert a percentage mark of type% d% G into it to insert data.

Using sprintf


char szBuff[16];
sprintf(szBuff,"%s%d","aaaa",i);

The above C language implementation of string characters and numbers together is all the content shared by Xiaobian. I hope it can give you a reference and support developeppaer.