title: How to assign a new value to some memory location in C
body: <p>I'm trying to access memory location pointed to by (char *addr) and store new value (char val). Here is how I try to do it.</p>
  
  <pre><code>int set_new_val(Cmd *cp, char *arguments) {
    char *addr;
    int val;
    if (!sscanf(arguments, "%x %x",&amp;addr,&amp;val))
    {
      return 0;          
    }
    printf("adr = %x || val = %x\n",addr,val);
    *addr = (char)val;
    printf("adr = %x || val = %x\n",addr,*addr);
    return 1;
  }
  </code></pre>
  
  <p>Any obvious (or not so) reasons why this wouldn't work is appreciated.</p>