Hamumu Software Hamumu Software Hamumu Software
Name
Password Register
Latest Journal update: Oct 18, 2017

Go Back   Hamumu Forum > General > Total Mayhem

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 08-26-2014, 01:09 AM   #1
REACTOR
Question the trends!
 
REACTOR's Avatar
 
Join Date: Apr 2011
Location: Malaysia
Posts: 1,162
Default Problem: Functions In C

I am regaining confidence and so far, know the ins and outs of a simple program, my next assignment is to write a function, and so I did by my father's words, but I don't have a clue what to do, the compiler keeps on throwing at me, unknown reference errors.
Here is my code for the main function at hand: The compiler throws no errors about it when I compile.

fmin.c
Code:
/*
 * Author: Sebastian
 * Date: 26/AUG/2014
 * 
 * Input: An array of integers, the size of an array can only be from 1-100. 
 * Output: The smallest number found from the array.
 * Description: This functions assigns a given array of values to a specific table, it then  *goes through a loop which
 * determines which value out of all the other values, is the smallest.
 * 
 */

int fminimum ( int table[] )
{

    int min = 0;
    int tableindex = 0;
    
    min = table[tableindex];
    
    for ( tableindex = 1; table[tableindex] != -1; tableindex++ )
    {
        if ( table[tableindex] < min )
        min = table[tableindex];
    };
    
    return (min);

}
And here is my header file code:

fmin.h
Code:
/*
 * Author: Sebastian
 * Date: 26/AUG/2014
 * 
 * Input: An array of integers, the size of an array can only be from 1-100. 
 * Output: The smallest number found from the array.
 * Description: This functions assigns a given array of values to a specific variable, table, it then goes through a loop which
 * determines which value out of all the other values, is the smallest.
 * 
 */

int fminimum ( int table[] );
When I declare my header file at the top of the program I am adding my new function to, I use "" not <>, so it's not the case with that, but whenever I say build, it gives a compilation failure error message, UNKNOWN REFERENCE TO FMINIMUM.

I don't know what I am doing wrong. I checked it up on the internet, but none of those guys give a clear explanation of what is happening.

Edit: And also, if I try to compile fmin.c, it will give an error of the same kind but telling me there is an undefined reference to main.

Last edited by REACTOR; 08-26-2014 at 01:31 AM.
REACTOR is offline   Reply With Quote
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rather serious problem TyTBone Costume Party 8 08-03-2009 12:14 PM
Problem Megadog Costume Party 5 03-02-2009 12:32 PM
DVD-ROM problem kacper8000 General Blabber 8 12-26-2008 08:19 PM
Li'l bro... Big Problem... hamumu2 Loonyland 13 08-01-2008 04:05 PM
Problem with add-ons thetroll2 Dr. Lunatic 8 01-28-2006 04:03 AM


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.
Site Map
Copyright 2017, Hamumu Games Inc.