Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can you quickly find the number of elements stored in a
a) static array b) dynamic array ?

Answer Posted / santhosh kumar sahukari

1.for static array we can find the no.of elements of its by using sizeof() operator and data type of that array.
2.we can find the no.of elements by its subscript in static array.
eg: int arr[10]
we can use sizeof(arr) to find the no.of elements it v l print 20,then we can divide it by 2 as size of int is 2.
2.subscript tells us it has 10 elements.

for dynamic array we cant use sizeof() operator.
we cant say dat how many elements it will have..it will be decided at runtime only.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of extern storage specifier?

1183


Is oops and c++ same?

1040


What jobs can you get with a c++ certification?

1048


Describe Trees using C++ with an example.

1147


When there is a global variable and local variable with the same name, how will you access the global variable?

1092


Explain what is oop?

1065


What is dev c++ used for?

1033


Why do we use setw in c++?

1108


What are punctuators in c++?

1153


How do I run c++?

1058


Explain the difference between realloc() and free() in c++?

1012


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1285


How does code-bloating occur in c++?

1190


What is a c++ object?

1154


What is difference between malloc()/free() and new/delete?

1163