Go Down

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


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


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.

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.



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

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().


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.

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.


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

i want to print 2 of them together


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.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131