I want to convert a char array[] like:
char myarray[4] = {\'-\',\'1\',\'2\',\'3\'}; //where the - means it is negative
So it should be the
Why not just use atoi? For example:
char myarray[4] = {'-','1','2','3'}; int i = atoi(myarray); printf("%d\n", i);
Gives me, as expected:
-123
Update: why not - the character array is not null terminated. Doh!