get int value from array of char in c language
I need your help, hope you can help me. I have array of charts just like
this example below.
char bytes[8]={2, 0, 1, 3, 0, 8, 1, 9};
So I want to take the first four chars from this array below, and put them
into a new integer variable. How can I do this? I am trying to shift them,
but this logic is not working. Any idea? Thanks.
Example: from this array to get: year month day
char bytes[8]={2, 0, 1, 3, 0, 8, 1, 9};
int year = 2013, mount = 8, day = 19
No comments:
Post a Comment