here why we hve taken n = sizof arr/ that whole line…
Regarding stl doubts
Hey so
sizeof(X) ’
This will return size of X in bytes
So if we pass an array ,this will give : no of elements*(size of data type of array)
=n*4 for int array
Now when we divide it by sizeof(int) i.e 4
it will give n
I hope this resolves your doubt
If it does then please mark it as resolved
Also please mark as resolved previous doubt if resolved
we have to take this n necessary in these ?
No u can take any variablename ,n is u can say conventional
here IT is not declared error is coming why we have taken auto it ?
share ur code…
it is running but not in my compiler ,anyways i want to know what is the work of auto keyword here
Auto automatically detects the data type
Auto it=5 here it will become int
Auto it =“sri”
Here it will become string etc