title: How to drop the warning "conversion to ‘char’ from ‘int’ may alter its value"
body: <p>I though that if I <code>cast</code> a number like this <code>(unsigned char)32</code> it will be enough to fix the compiler warning, but it wasn't like how I planed.</p>
  
  <p>Here i have the following part of the program which actually explain the problem:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void){
      char *ptr = malloc(6);
      const char *name = "MICHI";
      unsigned int i = 0;
  
      if(ptr){
          strcpy(ptr, name);
          ptr[strlen(ptr)] = '\0';
      }else{
          return 1;
      }
  
      while(ptr[i] != '\0'){
          if((ptr[i] &gt;= 'A') &amp;&amp; (ptr[i] &lt;= 'Z')){
              ptr[i] += (unsigned char)32;
          }
          i++;
      }
  
      printf("Name = %s\n",ptr);
      if(ptr){
          free(ptr);
          ptr = NULL;
      }
  }
  </code></pre>
  
  <p>When I try to compile it with compiler warnings ON, I get this:</p>
  
  <pre><code>error: conversion to ‘char’ from ‘int’ may alter its value [-Werror=conversion]|
  </code></pre>
  
  <p>This means thet the following <code>ptr[i] += (unsigned char)32;</code> doesn't provide a solution to my problem.</p>
  
  <p>My question is, how to drop this warning because I have no clue about it.</p>
  
  <p><a href="http://ideone.com/QWrcDl" rel="nofollow noreferrer">Ideone</a> doesn't helps to much, because I think that all warnings  are Turned off.</p>