HOW TO INTIALIZE AN ARRAY WITH ZERO IN CPP
first way
int arr[5]={0};
it will intialize your array with 0;
DISCLAIMER-IT IS NOT VALID FOR OTHERS NUMBER
FOR EXAMPLE IF YOU WILL TRY TO INTIALIZE ARRAY WITH 1
LIKE THIS int arr[5]={1}; so it will not intialize whole array with 1.
it will intialize first element as 1 and others as 0;
SECOND WAY
GOOD NEWS -> THIS IS VALID FOR EVERY NUMBER✌
int arr[size];
for(int i=0;i<size;i++)
arr[i]=number_with_which_you_want_to_intialize
😉
No comments:
Post a Comment