How can i store the address of a char variable?

    char ch='a';
char*chptr=(int *)&ch;
cout<<(int *)&ch<<endl;
cout<<chptr;   //this is not working

@Mukesh_1

Here you go

#include <iostream>
using namespace std;
int main() {
char a;
int* x = (int*)&a;
cout << x << endl;
}

Let me know if you still need any help.

1 Like

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.