Help? 
Author Message
 Help?

What is a good way of passing a string e.g. "112.43" to
a function and having the function display on screen
the values of each number, i.e. hundreds, ten, ones, etc.


Fri, 09 Jan 2004 20:11:58 GMT  
 Help?


Quote:
> What is a good way of passing a string e.g. "112.43" to a
> function and having the function display on screen the values
> of each number, i.e. hundreds, ten, ones, etc.

Well, as a string is nothing more than an array of characters
laying around in the memory you wouls simply pass a pointer to
that array to your function and than use that pointer for
displaying the string on the screen:

displaytoscreen(char *string)
{
  puts(string);

Quote:
}

void foo(void)
{
  char astring[] = "112.43";
  bar(astring);

Quote:
}

Still the question remains why one needs to use a function to
call another function. But I'ld guess you want to add some
output to the string!??

--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond



Fri, 09 Jan 2004 23:17:22 GMT  
 Help?
well this makes it easy
but use atof first ,store the no.as f
use atoi , store the no. as i
repeated use of (f%10) and f=f-f/10  will give you the postions of
numbrs before the decimal
and
suppose d=f-i;
then repeated use of (d*10 -d) and d= (d*10 -d) will give you the
positions after decimal.
Quote:

> What is a good way of passing a string e.g. "112.43" to
> a function and having the function display on screen
> the values of each number, i.e. hundreds, ten, ones, etc.



Sat, 10 Jan 2004 11:46:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP HELP HELP HELP HELP HELP!!!

2. HELP HELP HELP HELP HELP

3. HELP ++++++++++++++ HELP +++++++++++ HELP ++++++++++++++ HELP

4. OSP (Operating System Project) HELP HELP HELP HELP (files module)

5. HELP help HELP help

6. help VIRUS help help VIRUS help !

7. Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!

8. Help Help Help

9. Help ,Help <help , with my project

10. SOMEONE HELP ME, HELP ME, HELP ME PLEASE...

11. HELP HELP HELP ME PLEASE!!

12. HELP HELP HELP!!!

 

 
Powered by phpBB® Forum Software