C
cpptutor2000
Could some C++ guru please help me with this problem?
Suppose I have a string representation of a very large number
as: char *strNum = "1234";
now suppose I want to store this number with each digit as an
element of a large array: unsigned int Num[4];
Now I want to transfer them digit by digit to the unsigned int
array, with code as the following, but it does NOT work.
for(int i = 0; i < 4; i++){
if(isdigit(strNum) Num = strNum;
}
If I now print out the contents of the array Num, I get only
the ASCII values to be printed out, in this case:
49, 50, 51, 52
How do I make sure that the values stored are the digits 1, 2,
3 and 4, and NOT the ASCII values.
Could someone please point out what exactly I am doing wrong?
Thanks in advance for your help.
Suppose I have a string representation of a very large number
as: char *strNum = "1234";
now suppose I want to store this number with each digit as an
element of a large array: unsigned int Num[4];
Now I want to transfer them digit by digit to the unsigned int
array, with code as the following, but it does NOT work.
for(int i = 0; i < 4; i++){
if(isdigit(strNum) Num = strNum;
}
If I now print out the contents of the array Num, I get only
the ASCII values to be printed out, in this case:
49, 50, 51, 52
How do I make sure that the values stored are the digits 1, 2,
3 and 4, and NOT the ASCII values.
Could someone please point out what exactly I am doing wrong?
Thanks in advance for your help.