| | |
func return 2 values
![]() |
•
•
Join Date: Jan 2009
Posts: 36
Reputation:
Solved Threads: 0
like this ??
if yes, but we use the structer, and we should just use in the function the pointers without anything else ....
this is the code:
if yes, but we use the structer, and we should just use in the function the pointers without anything else ....
this is the code:
C Syntax (Toggle Plain Text)
#include <stdio.h> struct mytype { int ok; char ch; } mytype; struct mytype fundCalculation(int *a,int *b,int *c) { struct mytype tmp; if(*c==*a+*b) {tmp.ok=1;tmp.ch='+';} else if(*c==*a-*b) {tmp.ok=1;tmp.ch='-';} else if(*c==*a * *b) {tmp.ok=1;tmp.ch='*';} else if(*c==*a / *b) {tmp.ok=1;tmp.ch='/';} else {tmp.ok=0;tmp.ch=' ';} return tmp; } main() { int x=3; int y=4; int z=12; printf("%i %c ",fundCalculation(&x,&y,&z).ok,fundCalculation(&x,&y,&z).ch); getchar(); }
![]() |
Similar Threads
- How do I recognise strings and numbers (Python)
- How to create a .lib from a .def? (C++)
- Any help is appreciated (C++)
- so I find myself here again (C++)
- Return more than one value from a single function (C++)
Other Threads in the C Forum
- Previous Thread: Thread Scheduling - Please Help
- Next Thread: An implementation idea requied in Compiler Interface
| Thread Tools | Search this Thread |
#include * ansi array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop initialization input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation owf pdf pointer pointers posix power probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






