How can I get the maximum of an array?

Status
Not open for further replies.

fatma1000

Banned
Joined
Apr 30, 2006
Messages
147
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
eygpt
Activity points
0
hi all
how can i get the maximum of array?
please get the code in c++

thanks
 

Re: help1 C++

int ar[] = {1,2,3,4};

int num_elements =sizeof(ar);
int num_bytes = num_elements/sizeof(int);
 

help1 C++

you can either call sizeof() function or calculate manually by while loop reaching end starting from 0 index
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…