combine numbers in one

i don't know how to combine numbers from other variables in one variable :confused: :confused: :confused:
how i can do that here's my code(using arduino uno)

char a[] ="1";
char b[] ="2";
char c[] = "3";
char result;
void setup()
{
}
void loop()
{
Serial.begin(9600);
result= a[0] + b[0] + c[0]; //i just did a example to let see what i mean
Serial.println(result); //need to be: 123, of course not working
delay(1000) 
}

pls dont do like Serial.println(a), Serial.print(b) & Serial.print(c)
thank you guys!

Google strcat()

do you mean i need to search that?
i don't know what i need to do with it
but you help me all the time so i will give you a karma!

chickenprogram:
do you mean i need to search that?
i don't know what i need to do with it
but you help me all the time so i will give you a karma!

Yes, search that.

Do you want the string “123”, or the numeric value 123?

This line defines and initializes a C-string named "a", which is a zero terminated character array with two elements.

char a[] ="1";

The first element of "a", a[0], contains a value equal to the printable ASCII character for the number 1 and the second element, a[1] contains zero.

char a[] = "1";
char b[] = "2";
char c[] = "3";
char result[4];  // Room for three characters and a terminating null


void setup()
{
    Serial.begin(9600);
}


void loop()
{
  strcpy(result, a);
  strcat(result, b);
  strcat(result, c);


  Serial.println(result);
  delay(1000);
}

johnwasser:

char a[] = "1";

char b = "2";
char c = "3";
char result[4];  // Room for three characters and a terminating null

void setup()
{
   Serial.begin(9600);
}

void loop()
{
 strcpy(result, a);
 strcat(result, b);
 strcat(result, c);

Serial.println(result);
 delay(1000);
}

thank you, can you say me how it works?

Try here

chickenprogram:
thank you, can you say me how it works?

The function "strcpy" copies a string to a character array.
The function "strcat" 'concatenates' (adds to the end of) a string to a character array containing a string.

After "strcpy(result, a);" the 'result' array contains the string "1".
After "strcat(result, b);" the 'result' array contains the string "12".
After "strcat(result, c);" the 'result' array contains the string "123".

Every string ends with a character with a zero value, called a 'null terminator'. That's how the functions know how long the string is.