We have learned that in case of an array like int a[]={1,2,3};
if we print a as cout<<a;
then it prints the address of the first element of the array. But for character array char a="Jayesha
;* when we do cout<<a;
it prints the whole array instead of its address. Also if we print &a[0]
it prints 'Jayesha', &a[1]
prints 'ayesha', &a[2]
prints 'yesha', &a[3]
prints 'esha' and so on...
Can anybody please explain why that happens??
Aucun commentaire:
Enregistrer un commentaire