Linux C 内核代码中 整型转化为字符串 的 问题、。
#include <config.h>#include "inttostr.h"/* Convert I to a printable string in BUF, which must be at least INT_BUFSIZE_BOUND (INTTYPE) bytes long. Return the address of theprintable string, which need not start at BUF. buf的长度必须大于等于INT_BUFSIZE_BOUND (INTTYPE) bytes long*/char *inttostr (inttype i, char *buf){ char *p = buf + INT_STRLEN_BOUND (inttype);//p指向内存的尾端; *p = 0;//末端置0; if (i < 0) { do *--p = '0' - i % 10; while ((i /= 10) != 0); *--p = '-'; } else { do *--p = '0' + i % 10; while ((i /= 10) != 0); } return p;}