Re: A little help please

From: Alwyn (alwyn_at_blueyonder.co.uk)
Date: 12/28/04


Date: Tue, 28 Dec 2004 13:48:44 +0000

On Tue, 28 Dec 2004 12:36:34 +0000, Rich wrote:
>
> I think I need to be doing the static_cast again in the function to cast
> back to an int.

No. 'arrX' is already an array of 'int', so no casting could possibly be
required.

> I am well and truly stuck!!

What was wrong with my solution? If you really must have the 'static_cast'
to 'void *', just subsitute:
void *vptr = static_cast<void*>(arrX);
func1(vptr, sizeof(arrX), '\010');
for
func1(arrX, sizeof(arrX), '\010');
and it should be doing everything the question asked.

Do I think this is a good way to learn C++? No, I don't, but in order to
complete a course successfully, you have to do everything the teacher
asked for. Real learning can come after.

Alwyn



Relevant Pages

  • (patch for Bash) regex case statement
    ... Following up on my previous patch for regex conditional tests, ... /* Return an array of strings; ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)
  • Re: Strategy or Iterator?
    ... It would be possible to write a class that returns the variations ... GNU General Public License for more details. ... protected CombinatoricOperator(Telements, int r) { ... An integer array backing up the original one to keep track of the ...
    (comp.lang.java.programmer)
  • (patch for Bash) regex conditional tests
    ... 'regex' are returned in array variable SUBMATCH. ... Skipping of positional parameters, array elements, string ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
    (comp.unix.shell)
  • Re: Function pointer array as parameter to a function
    ... int > Now that I try to find an example, ... happy with the cast when written without the 'char': ... Gives "cast x into function returning pointer to array of pointer to ...
    (comp.lang.c)
  • Re: Type Casting IPv4 and IPv6 structures to Generic Structures
    ... > int a,b,c,d; ... >Now, if I understand correctly, your question is what happens when you cast ... then it's better to declare it as array of unsigned char. ... Dan Pop ...
    (comp.lang.c)