read

Get ASCII value

 char c = 'A';  
int x = (int)c;


Now x is equal to 65 (ASCII code of char ‘A’)
<h3>
</h3><h3>
</h3><h3>Convert ‘1’ char to 1 int value</h3><div>Only works with chars ‘0’ - ‘9’

</div><pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"> char c = '1';
int x = (int)(c - '0');
</pre><div>
</div><div>Now x is equal to 1</div>



 Source

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview