Doubt here, if all the elements of array are -ve

in this program if all the elements of array are -ve then max sum would be 0 and that would be wrong

hello @anujsharmabadboy
yeah u are right,
to handle such case initialise ur maximum variable with any element of the array.
then apply the algorithm

algorithm mean ??
algorithm header file ??
how can we do that from there ??

by algorithm i mean the logic u are applying for the problem

it may be possible from climits header file
from there we can assign int_min (- infinite) to maximumsum
am i right ??

@anujsharmabadboy
then it will fail again when all element of ur array have value less than int_min.

it is better to intialise it with some element of ur array.