Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an Array of Strings?

Status
Not open for further replies.

bont

Programmer
Sep 7, 2000
200
US
I have been pondering how to create an array of strings:

first I create a string--
char my_string_item[1000];

then I must create an array of type my_string_item

How do I do this? I keep erroring.

P.S. I would like 1000 strings in my array so

my_string_item my_string_array[1000] ????

[sig][/sig]
 
Hi Bont,
It looks like you are trying to declare an array of characters... not strings. Try
string my_string_item[1000]
this should declare an array of type string with a size of 1000.
I'm not sure if this is the answer you are looking for.
[sig][/sig]
 
I am trying to create an array of STRINGS. Each item in the array would be a string of length 1048. There will be 1000 items. Is this possible? [sig][/sig]
 
use 2-D char array:
char my_string_item[1000][1048];

a string can be referred as my_string_item[0]
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top