Seeing this thread I wrote the following: How do I convert from void * back to int
#include <iostream>
#include <stdlib.h>
using namespace std;
int main (int argc, char *argv[])
{
void* port = (void*) atoi (argv[1]);
cout << "\nvalue: \n" << atoi (argv[1]) << "\n";
int h = *((int *)port);
cout << h;
}
output:
anisha@linux-dopx:~/> ./a.out 323
value:
323
Segmentation fault
anisha@linux-dopx:~/>
GCC
What's the point that I am missing?