Go Down

Topic: congestion 2 character's (Read 424 times) previous topic - next topic

Mohamed_Aouf

any one know how to congestion 2 char , i need it char for function used only char


char x = 1 ;

char ='g';

i need to show  1g

AWOL

#1
May 06, 2013, 10:37 pm Last Edit: May 06, 2013, 10:41 pm by AWOL Reason: 1
Please tell us what you're trying to do - your question is nonsense.
Code would be good.

Quote
i need to show  1g

9.81 ms-2
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Arrch


congestion


You mean concatenate?

Code: [Select]
char x = 1 ;

You you mean x = '1'? 1 and '1' aren't the same values

Code: [Select]
char ='g';

variables need names

Quote
i need to show  1g

If you're dealing with single characters, you can build a string of them using sprintf(). If you're using strings already and want to concatenate them, then you should look at strcat().

Grumpy_Mike

Does your use of the word "congestion" really mean concatenate?

If so you can not concatenate two chars into one, you have to put them next to each other in an array.

 
Quote
char x = 1 ;
char ='g';
i need to show  1g

x is not a char that will ever be displayed as 1, it is char = 0x31 that will display as one.

As AWOL says you need to say what it is you are trying to do because what you are asking does not make sense.

Mohamed_Aouf

char x[]="hello" ;
char x[1]='1';

i want to print 2 of them together

PeterH

It's very hard to understand what you're trying to do, but I think you're trying to produce a string containing some constant text and some variable data. In that case sprintf() is probably what you're looking for.

Code: [Select]

int myValue = 7;

char message[20]; // variable to hold the formatted message
sprintf(message, "hello %d", myValue);

// message now contains "hello 7"
I only provide help via the forum - please do not contact me for private consultancy.

Mohamed_Aouf


Go Up