| | |
pointers to function
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 18
Reputation:
Solved Threads: 0
hey guys
i am using miracle c compiler on windows xp....
i am trying to figure out how does pointer to functions work.....
i have gone thru many tutorials but all have them failed to compile....
i get this error.......
C:\Program Files\Miracle C\work.c: line 21: Parse Error
'int (*pfun)(int, int)'
aborting compile
pls tell me wats wrong and also send me source code explaining the pointers to function
i am using miracle c compiler on windows xp....
i am trying to figure out how does pointer to functions work.....
i have gone thru many tutorials but all have them failed to compile....
C Syntax (Toggle Plain Text)
#include <stdio.h> int sum(int x, int y) { return x + y; } int product(int x, int y) { return x * y; } int main() { int a = 13; int b = 5; int result = 0; int (*pfun)(int, int); pfun = sum; result = pfun(a, b); printf("\npfun = sum result = %d", result); pfun = product; result = pfun(a, b); printf("\npfun = product result = %d", result); } //this source code is from //http://www.java2s.com/Code/C/Function/Pointingtofunctions.htm
C:\Program Files\Miracle C\work.c: line 21: Parse Error
'int (*pfun)(int, int)'
aborting compile
pls tell me wats wrong and also send me source code explaining the pointers to function
>i am using miracle c compiler
Miracle C is a horrible compiler. Trash it and get anything else, or you'll have to suffer through constant battles of perfectly valid code failing to compile or not working correctly.
Try Code::Blocks, Turbo C++, or Visual C++.
Miracle C is a horrible compiler. Trash it and get anything else, or you'll have to suffer through constant battles of perfectly valid code failing to compile or not working correctly.
Try Code::Blocks, Turbo C++, or Visual C++.
Last edited by Narue; Nov 12th, 2008 at 10:07 am.
New members chased away this month: 5
•
•
Join Date: Nov 2008
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
>i am using miracle c compiler
Miracle C is a horrible compiler. Trash it and get anything else, or you'll have to suffer through constant battles of perfectly valid code failing to compile or not working correctly.
Try Code::Blocks, Turbo C++, or Visual C++.
so how can i use visual c++,turbo c++......
pls can u suggest a compiler for windows.........
its urgent.....
>i am learning c
C++ compilers can compile C. Usually all you have to do is name the source file *.c instead of *.cpp.
>pls can u suggest a compiler for windows.........
I suggested three of them. They're all easy to install and use. Stop being lazy.
>its urgent.....
Not for me.
C++ compilers can compile C. Usually all you have to do is name the source file *.c instead of *.cpp.
>pls can u suggest a compiler for windows.........
I suggested three of them. They're all easy to install and use. Stop being lazy.
>its urgent.....
Not for me.
New members chased away this month: 5
![]() |
Similar Threads
- c language problm, how to pass pointer to a function (C)
- Passing 2D Array of Pointers into a function (C++)
- Pointers to function question (C++)
- Sorting arrays of pointers with function? (C)
Other Threads in the C Forum
- Previous Thread: help me in array
- Next Thread: Reading ints from a file
Views: 546 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory drawing dynamic executable execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest homework i/o ide include infiniteloop initialization interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send single socketprogramming spoonfeeding stack standard strchr string student suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32 win32api windows.h






