I found a way to calculate length of array of strings as sizeof(first)/sizeof(first[0]) on cplusplus.com and no other method works for finding the same.
Can you explain how sizeof(first)/sizeof(first[0]) is working ??
Length of array of strings
@S19WDPP0014 hey size of first will give the whole size array and size of first 0 will give size of first element of array ,if we divide them we will get size of array ,suppose array is 1,2,3 so size of array will give 12 as there are 3 integrrs of 4bytes so total size is 12 bytes ,size of array 0 is 4 as it is int now divide both the values which will give 3 which is size of array.
ya but in case of
string searchIn [] = {"prateek", "sneha", "deepak"};
we should get 18/7 (sizeof of searchIn = 18(total char’s size ie 7+5+6), sizeof searchIn[0] = 7)
and this is not correct answer
@S19WDPP0014 hey is case me different hoga ,you can use:
size = sizeof(searchIn) / sizeof(searchIn[0]);
please explain with all the intermediate values how this is giving the length
@S19WDPP0014 hey simply use size function of stl of array to calculate size or use above formula as mentioned properly.