Search:
Forum
Beginners
add char array into another char array
add char array into another char array
Apr 17, 2012 at 9:59am UTC
difenbahij
(10)
hello,
the question is how to add char ca and char cb into char c?
//char c {'0','1','2'} = char ca{'0'} + char cb{'1','2'}
tnx
Apr 17, 2012 at 11:02am UTC
hamsterman
(4538)
If you have
1
2
3
char
ca[] = {
'0'
};
char
cb[] = {
'1'
,
'2'
}; car c[3];
to make c = ca + cb, you have to copy all elements of ca to the beginning of c and all elements of cb immediately after those. If the arrays were 0 terminated, you could use strcpy and strcat, but now you write the for loops yourself.
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs