Hi to all
I have a quick question. I am going to fill an array with some inpuit of type char using member function cin.getline. After I fill an array ,I would like to do "for" loop so I need to know what is curently the size of an array. Is it possible. Looks like stupid question because I initialized the array that contains 250 elements (and what I know so far I can't chang ethe size of array, isn't right?). But if I would enter let sey 25 characters. Is the size going to change?Is it possible. If so how may I got the current size of the array. If not what is the best choice to fill an array (maybe vector ?) ,tht will let me know the current size of array
Thank you
mauro21pl
10
Junior Poster in Training
Recommended Answers
Jump to Postthere is a function in c++ called strlen() which tells you the length of an array... if not, you can use a while loop with a counter that exits when
array[i]=='\0'
Jump to PostHi to all
I have a quick question. I am going to fill an array with some inpuit of type char using member function cin.getline. After I fill an array ,I would like to do "for" loop so I need to know what is curently the size of an array. …
All 7 Replies
ndeniche
402
Posting Virtuoso
Featured Poster
Bench
212
Posting Pro
Narue
5,707
Bad Cop
Team Colleague
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
mauro21pl
10
Junior Poster in Training
serkan sendur
821
Postaholic
Banned
Narue
5,707
Bad Cop
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.