Convert long to char

Hello everyone how can i convert a long variable into a char variable?

If you click here you'll find ths question was already posted, here

long i = 12345;
char c = (char) i;

You will loss 3 most significant bytes of long variable.

You should provide better description of the problem, otherwise you can obtain senseless answer.

Budvar10:

long i = 12345;

char c = (char) i;



You will loss 3 most significant bytes of long variable.

You should provide better description of the problem, otherwise you can obtain senseless answer.

The purpose of the program is to combine two variables with a comma ... so it works

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

void setup() {

Serial.begin(115200);
}

void loop() {

char stringa[4];
stringa[0]= '3';
stringa[1]= '.';
stringa[2]= '4';

float coordinate ;
coordinate = atof(stringa);
Serial.println(coordinate);
}

I have two variables 'a' and 'b' where there are coordinates so long use variable variables, the purpose of the program is to combine variables a and b with a comma...
Instead when I go to insert the two variables "a" and "b" I no longer work and so I thought to convert "a" and "b" into two charitable char

#include <stdlib.h>
#include <stdio.h>
long a ,b;
char c,d;
void setup() {
long lon;
Serial.begin(115200);
}

void loop() {
lon= 1400700529 ;
a =lon/1000000;
b = lon%1000000;

char stringa[4];
stringa[0]= a;
stringa[1]= '.';
stringa[2]= b;

float coordinate ;
coordinate = atof(stringa);
Serial.println(coordinate);
}

char stringa[4];
stringa[0]= '3';
stringa[1]= '.';
stringa[2]= '4';
strings[3]='\0';

Please remember to use code tags when passing code