Creating a frequency array

When the frequency array in the counting sort function was created, the statement written is " new int[largest+1]{0} ". Can you please the syntax of this statement and shouldn’t we use = between [ ] and {0}.

hello @gautam74

in case of dynamic memory allocation, if we want to initilaise the array element with 0 then the synatx is

int *arrayName= new int[size]{0};

you can use = in between [] and {}

Screen Shot 2021-04-22 at 12.52.04 AM

Both the formats are giving an error while compiling the program with a gcc compiler.

Screen Shot 2021-04-22 at 12.51.26 AM

try compiling it in cb or any other online ide, it will work.

your compiler might not be updated

yeah… could be problem with my compiler since it is working on CB ide.