Doubt on array initialize

how can I initialize integer array with all default values=1

like we do for 0 -> int a[20]={0};

hello @prerak_semwal
use loop or memset function

@aman212yadav
I wanted something short like we do for ‘0’ !

how to use memset ?

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