Re: How to understand this line of c ?



Keith Thompson writes:
>Can you provide an example, in C code, of what you're talking about?

(in reference to casting a string to an int)

Off the top of my head, I can't remember when I've used this. Vaguely
I remember having a program that needed to run X number of times. So I
passed an argument "123" which main's argv got.

Now in order to run it that many times, I needed to cast "123" to an
int 123, so I could use it in a counting loop.

If I get a chance, I'll look through some of my source code to see
where I've used it.

.



Relevant Pages

  • Re: some c# questions!! please send me the answer
    ... TryParse first to see if the string is a valid DateTime before doing ... In .NET 1.1 all you can do is Prase and catch any exceptions ... Boxing is creating a "reference" shell around a value object so that it ... each "int" and then adds those object wrappers to the ...
    (microsoft.public.dotnet.csharp.general)
  • Re: ClassCastException in the put() method of hashtable.
    ... ClassCastException means that whatever type you're casting to isn't the ... type the variable needs. ... because c's an int and you're trying to cast ... it as a string and assign it to c. Can't do that. ...
    (comp.lang.java.help)
  • Re: How to understand this line of c ?
    ... > int 123, so I could use it in a counting loop. ... conversion from one type to another. ... program's first argument happens to be the string "123", casting ...
    (comp.lang.c)
  • Re: casting and converting
    ... string and int are two complety different types. ... Basically, casting only ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Reflection Values
    ... want based on type, or, you could just call the ToString method on the ... that would be "String" in the first case hence> casting the Property as a String.... ... and an "int" in the second case,> casting that property as an int... ...
    (microsoft.public.dotnet.languages.csharp)