C++ sucks for formatting output especially when it contains a variable number of arguments.
It looks like standard C xxprintf() formatting type functionality is what you are looking for.
If all you need to do is create a string for debugging output, then use sprintf().
char buf[64]; // don't create strings larger than this (declare this up top out side setup()/loop() )
sprintf(buf, "X Max=%d X Min=%d X Center=%d", X_Max, X_Min, (X_Max-X_Min)/2);
Serial.println(buf);
And if you want to get a bit fancy you can use some macros and tie into
the AVR libc vfprintf() stuff to give you a Debug() call to output your strings.
I attached an example sketch that does this.
It has the advantage of automagically moving the formatting strings into progmem
so you don't chew up ram and also does not have to use a static fixed size buffer.
Have a look.
Using the code in that example sketch, you could output your debugging information like this:
Debug("X Max=%d X Min=%d X Center=%d\n", X_Max, X_Min, (X_Max-X_Min)/2);
Thanks Bill, I am looking at your code now. I am still alot vague on how to use pointers and references as args in C, I am so used to explicit keywords such as Set and Let and getRef(). I may pull all my many folicles out before I get a grip, but I will succeed as failure is not an option.