|
-
Dec 20th, 2000, 07:25 AM
#2
Frenzied Member
char is a datatype representing one character. A string is an array of characters, you have that bit right, but you need one array element for each character in the string. You need to declare your char arrays to be bigger.
Secondly, I think you have the wrong idea about how C handles strings. They are quite complicated compared to VB when you use char arrays and not some of the special string classes which simplify them. You can't just concatenate strings using the + operator. You need to use a function to do it, I have forgotten which, but it may be using strcopy().
part1 written just like that will return a pointer to the first element in the array, the same goes for part2, and similarly the string " " is just a pointer to that string literal within your executable. So you are assigning a pointer plus a pointer plus another pointer to the address of the array total, and you can't do that.
Also, you forgot a semicolon just before your comment.
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|