C language convert long to string

C language convert long to string

The lto () function is used to convert a long data type to a string data type.
The syntax is as follows:

char *ltoa(long N, char *str, int base);
Source:w‮al.ww‬utturi.com

Example:

/*
Example: ltoa funciton in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    long l = 12340;

    char str[33];
    char * res;
    res = ltoa(l,str,10);

    printf("%s",res);

    return 0;
}

output:

12340
Created Time:2017-08-29 09:26:19  Author:lautturi