The C language implementation concatenates characters and Numbers

  • 2020-06-23 01:29:49
  • OfStack

C is a relatively low-level language in which all data is represented by integer, floating point, array, pointer 1 data structure.

By contrast, higher-level languages have more freedom to convert between data types.

After all, different languages have different design purposes.

In the C language, you can use the sprintf function to string integer or other types of metaclass data.

The first argument to the sprintf function is the output string, the second is an Format String, format description. Insert the percent sign tag of the %d %g 1 class to insert the data.

Use sprintf


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

Related articles: