is it possible to accept values via a function without directly using scanf(). if yes plz tel how. plz look at the attachment, wats the error in it? how can i achieve the aforesaid intention.
is it possible to accept values via a function without directly using scanf(). if yes plz tel how. plz look at the attachment, wats the error in it? how can i achieve the aforesaid intention.
- Your file ends in .cpp. You are asking for help in the C subforum.
- You can only return one variable or value. You are attempting to return multiple variables in your scan() function.
- The pointers in your scan() function are dangling pointers. You never initialized them.
- Your program uses the scanf function directly.
- There are multiple ways to scan in data. For example, using gets. But gets is not a "safe" function.
- Using "goto" when not needed is generally seen as a poor programming habit.
- conio.h isn't standard C. It's better to just use getchar to keep the console open.
Last edited by Phenax; 04-07-2011 at 09:16 PM.
Originally Posted by Plato
but how can it be done??
Yes, by using say, fscanf or sscanf, or by parsing the input yourself.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)