Sir doubt in pointer

@11:27 sir here it is siad we should avoid initilazing the address of int to char ptr as if we try to print or collect the content store at address in char ptr it will collect only of 1 byte but i tried coding it up it showed and error int ptr coversion is not possible to char ptr

#include

using namespace std;

int main()

{

int x=10;

char *ptr;

ptr=&x;

cout<<ptr<<endl;

}

@tejasddongare yes it will give error you cant store char address in int or vice versa(its not logically right)
hope its clear if yes dont forget to hit like and mark resolved :smiley:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.