|
-
Sep 2nd, 2002, 12:44 PM
#1
Thread Starter
Hyperactive Member
How about this one
I want to make an array that contains strings... how do I go about this? For example, in Perl I would type:
@bleh = ("bleh", "blah", "heh", "haha")
That's what I want... an array with strings... but in C. And how do I declare it?
-
Sep 2nd, 2002, 12:46 PM
#2
Frenzied Member
char mystring[len][numwords];
always worked for me
-
Sep 2nd, 2002, 01:20 PM
#3
Thread Starter
Hyperactive Member
Does anyone know any tutorials that cover C programming REALLY well... like everything in really great detail. I'm mostly looking for more on strings and arrays. I need a few that are really detailed. Thanks in advance!
-
Sep 2nd, 2002, 01:58 PM
#4
Ya ya Baby!!!Me is Back
char cMyArray[2] = {"ok","bye"};
-
Sep 2nd, 2002, 02:15 PM
#5
Frenzied Member
you can't store "ok" and "bye" in a character...
-
Sep 8th, 2002, 03:23 AM
#6
Frenzied Member
Code:
#include <string>
using namespace std;
void main(){
string str[2] = {"ok", "bye"};
}
-
Sep 8th, 2002, 04:37 PM
#7
New Member
CString
I would try to avoid using 2 dimensional character arrays for strings.
Make use of the CString library available.
CString works for one string, CStringArray works for an array of CString's. If you need more information just ask and I'll be glad to help you out.
-
Sep 8th, 2002, 05:18 PM
#8
Frenzied Member
USE the STL string over a CString, as the STL string will be availible with just about any compiler that is worth its salt.
Z.
-
Sep 9th, 2002, 04:12 AM
#9
CString is also only available with either MFC or ATL, both of which will press you into a predetermined application scheme.
Probably not what you want.
Use the STL string, maybe the STL vector (some people have problems using a vector of strings).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|