converting a string to a int value

How do i convert a string of words into a int value?

What is the code for it?
Did you tried to use the search feature of this site?
I guess not... Try entering the exact title of this topic, you will find what you want.
A string of words like "seven hundred twenty two" ?
If you meant that, than I'm sorry, you will not find it there. But make your question more obvious next time.
Last edited on
i tried searching to no avail?

my question is for example a string "This is a boy" and to convert this into a integer value. how do i do it?
That doesn't make sense...
Do you want a hashing function?
Last edited on
It doesn't have an integer value to convert to. What it DOES have is a string of characters that can be represented as both a number and a letter. Maybe you wanted this?
MyString[x] Where x is the character you want to get.
atoi(char *)
well you can convert it into an integer with the help of the function strlen() ,witch is found in the string.h library.the function returns the number of characters that the string is composed of.for example "hello world" the function will return the value 11. any character is evaluated,even space.
that is all y can think of.hope it helps.
this is an example of the source code and the parameters of the function.
1
2
3
char Text1[20]={"Hello World"};
int TextSize=strlen(Text1);
printf("%d\n",TextSize);
Last edited on
Topic archived. No new replies allowed.