How to set a string array?
Tell me how in Win32 make an array that will store strings?
I need not immediately display a string, and after you enter the n-th number of strings and output those that match the condition, so I need somewhere to store!
Here is the code
Writes all neobyatny ID.
I have a stream of characters, I need to display those rows that are greater than 80 characters. Here, in order to store them somewhere I need an array of strings. - 10-08-2011 в 04:33:57
Cleaned 2 neobyatny ID less.. - 10-08-2011 в 20:42:00
And if you think? Try
I write in Visual C++ 2010 and there are no operators like cout cin etc. so I don't know how to set the vector in it(( what you suggested maybe there is a solution to the problem, but how it will look in code, I have no idea.. - 10-08-2011 в 21:07:34
See VC++. To use cout and cin need to write
"Thank you, will teach.. PS. read the book by B. Kernighan, D. Ritchie, the C programming Language."
Book is very good. Let's talk about the C (without pluses).
In my opinion, Your problem is that in C no built-in type "string". There is a built-in type character (char). Characters can be aggregated into arrays and thus be placed in adjacent (consecutive) bytes of memory. Declare this:
A string in C call such an array, but rather the initial byte, terminated by zero (binary). When we write a constant string, for example
the compiler allocates memory for these characters (creates an array of sufficient size), and enters its address in the variable s (of type pointer to character(s)).
In Your case an array of strings really needs to be an array of pointers to characters.
Overflow array too long lines, observe yourself.
If desired, the array can be made dynamic by declaring it char **array and independently placing it in memory, increasing as needed. To do this, read about realloc().
Good answer. Purely in C. - 10-08-2011 в 23:30:18
Thank you very much, tomorrow I will try. - 11-08-2011 в 04:18:28
Pure C++ (with STL) -
Need some library to connect? Bo he gave me a bunch of errors.. - 09-08-2011 в 23:08:55
Yes. For the first #include
Pasib huge, there is ICQ? if you have more questions from a beginner?) - 10-08-2011 в 01:21:20
When connecting the #include