how can I initialize integer array with all default values=1
like we do for 0 -> int a[20]={0};
how can I initialize integer array with all default values=1
like we do for 0 -> int a[20]={0};
sry , it works with -1 and 0 and not with 1. refer this-> link
u can use fill_n function to initialise array elements with same value. read more about from documentation