+ 2
Check this why is it so?
#include<studio.h> int main(){ int arr[]={1,2,3,4}; int *ptr=arr; sizeof(arr);//16 sizeof(ptr);//8 } Even though both arr and ptr are both pointers why sizeof operator return different values.
4 Answers
+ 7
*arr* is not a pointer, it is an array whereas *ptr* is a pointer hence the output.
also sizeof operator is operated at compile-time and not runtime that's why sizeof array is known and not sizeof memory block pointing by pointer *ptr*
+ 4
An array can be implicitly converted into a constant pointer, but it is not a pointer.
+ 2
Because arr is not a pointer, it's an array
(int[4] not int*)
+ 1
But they say that name of array is constant pointer