'C' code

This is a discussion on 'C' code within the C Programming forums, part of the General Programming Boards category; please would anyone consider helping me write code? i need help with accessing a function from within the main and ...

  1. #1
    c_coding_is_fun
    Guest

    Question 'C' code

    please would anyone consider helping me write code? i need help with accessing a function from within the main and within other functions and im not sure how to do it .

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    whats hard about this....
    Code:
    #include<stdio.h>
    void func1(void); /* prototype for function */
    void func2(void);
    
    int main()
    {
    func1(); /* function call */
    func2();
    return 0;
    }
    
    void func1(void) /* function definition */
    {
    printf("We are in func1 now \n");
    }
    
    void func2(void)
    {
    printf("We are in func2 now \n");
    }
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Unregistered
    Guest
    yes that sounds nice an easy but i need the function to create an index from a specified input of chars and digits. i need to access this function from within another function and then use that index to access a file

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    simple.....

    int GetIndex(char* Key)
    {
    /* Do stuff with key to get an int index */
    return index;
    }

    then when you call it....

    int index;
    index=GetIndex("ABC123DEF567");

    etc.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21