Pages: [1]   Go Down
Author Topic: congestion 2 character's  (Read 385 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 303
Posts: 26354
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: May 06, 2013, 03:41:07 pm by AWOL » Logged

"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.

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3384
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

congestion

You mean concatenate?

Code:
char x = 1 ;

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

Code:
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().
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34246
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

i want to print 2 of them together
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
int myValue = 7;

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

// message now contains "hello 7"
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

U SAVE MY DAY , THANKS BRO smiley)
Logged

Pages: [1]   Go Up
Jump to: