| | |
Wats the problem in this Prog???
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 42
Reputation:
Solved Threads: 4
I'm getting an error msg as Type mismatch in redeclaration of 'putw' for the following code... Can anyone suggest the reason for this???
C Syntax (Toggle Plain Text)
#include<stdio.h> union pw{ short int i; char ch[2]; }; int putw(short int num, FILE *fp); int main() { FILE *fp; fp=fopen("test.tmp","wb+"); putw(1000,fp); fclose(fp); return 0; } int putw(short int num, FILE *fp) { union pw word; word.i=num; putc(word.ch[0],fp); return putc(word.ch[1],fp); }
Last edited by Tekmaven; Aug 4th, 2008 at 6:30 am. Reason: Code tags
Name putw() to something different like putword(). Most likely there's an implementation of putw() already prototyped in your compiler library.
Please, make sure you use proper tags when you post code next time. Here's how.
Please, make sure you use proper tags when you post code next time. Here's how.
Last edited by Aia; Aug 4th, 2008 at 12:12 am.
![]() |
Other Threads in the C Forum
- Previous Thread: anyone knows chip programming with c
- Next Thread: Twin primes
| Thread Tools | Search this Thread |
* adobe ansi api array arrays binarysearch calculate centimeter char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. lowest match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h windowsapi






