c - reading strings to a char array and then getting the size of the strings -
I am working on a project and I am stumped on this part.
I need to read from words Stdin and place them in a four array and use an array of signals to indicate each word, because they will become denticular. Where numbers read an integer in representing the number of words.
Four words [10000]; Four * word [2000]; The problem is that I can use only the indicators to add words. I can not use [] for help now
* wordp = word; // Set the first pointer at the beginning of the four arrays (T & LT; MMRDAs) {scanf ("% s", * (wordp + t)) // This is the part that I do not know wordp = words + charcounter; // charcounter is the number of characters in the preceding word t ++; } For (int i = 0; word + i! = '\ N'; i ++) {charcounter ++; } Any help would be great, when I talk about points and arrays, I get very confused.
If you use an additional pointer reference and increment directly, then your code will be more manageable. You do not have to do any mental math as well. In addition, you need to increase the reference before reading the next string; scanf does not take the pointer for you. four buffers [10000]; Four * words [200]; Int number_of_words = 200; Int current_words_index = 0; // we're going to use buffer four * to write; Current_buffer_prt = buffer; // instant memeset (as I do not remember if c does this for us) bu (i
Comments
Post a Comment