Question: I made a method that receives an int\* and this value will be assign to another int\*.
When I call the method, I put an integer but I receive the error of conversion.

I try to cast the int with (int\*) but the program crashes.

```
add(hashTable,  8, 0);

void add(hash_table *hashTable, int *num, int value)

```

How can I assign an integer value to an int\* in a method?

Answer: 
First, you should understand what `int *` means. It means you have an int somewhere in memory, and rather than copying the value of that int into a function, you pass in the address of that variable. You can't pass in the address of a variable until you first have a variable. So the simple solution is to create a variable and give that variable the value you want. Then you can just pass in the address of that variable.

```
int n = 8;
add(hashTable, &n, 0);

```
int's are integer values, and int \* is a pointer to an integer. In other words, int \* is a location in memory that points to your integer. In order to to assign an int to an int \*, you need to put the int into the memory location pointed to by int \*. To do this, you simply put the integer at the memory location pointed to by int \* (assuming the memory is already allocated)

```
 int *my_pointer = (int *)malloc(sizeof(int));  // allocate memory 
 *my_pointer = my_val;

```

(you must allocate memory here, or it will crash)

or

```
 int my_val = 8;  // the memory is allocated here, so you are safe
 int *my_pointer = &my_val;

```