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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Array Elements

Status
Not open for further replies.

pghsteelers

Technical User
Apr 21, 2006
121
US
Is there any other "simple" way of finding the number of elements in an array besides using the operator "sizeof"?

Such that:

sizeof arrVar1 / sizeof arrVar1[0]

Since this is dealing with actual bit size defined by the type it is listed as.

 
You could use a vector instead of an array, then use the size() method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top