I’m writing a program that receives a text input from the user, and saves it in an array of pointers, each word as a pointer (let say in char** words)
My question is: once I have it, how would I know the size of words?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no way to look at a C array and tell how many elements it contains, so you’ll need to keep track.
In fact, you likely need to keep track of 2 things: (1) how large the array you’ve created is (the maximum number of words you can handle), and (2) how many words you’ve actually seen so far.