passing char pointer to the function in C. just thirst position is taken : I have a tiny problem. I want to pass a string (char pointer) to a function. In the function, I can just pass the first position of the char pointer. 

Here is the code-snippet:

    void put(struct DataItem* hashArray[SIZE], char* key){
    struct DataItem* item = malloc(sizeof(struct DataItem));
    item->key = *key;
    item->value = 1; 

So, when I call the debugger and check the value of "item->key". Then its just the first position of the char pointer. 

For example I m passing "524234" 
Then item->key is just "5"

 


