0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>




int main(int argc,char **argv) {
    int one = atoi(argv[1]);
    int two = atoi(argv[2]);
    int finally;
    finally = func(one,two);
    printf("%d",finally);
    return 0;


}


int func(int first,int second) {
    int counter = 0;
    int new = first;
    while (counter != second)
        new = new*first;
        counter += 1;
    return new;

}

Im very new to coding so a lot of this might look like nonsense, So this code is a complicated way of using the power arithmetic operation,5*3 == 125, so if i type (./a.out 5 3) it should give out 125, i seem to get this error

extension.c:15:19: warning: implicit declaration of function 'func' is invalid
      in C99 [-Wimplicit-function-declaration]
        finally = func(one,two);
              ^
1 warning generated.
Brian Bi
  • 111,498
  • 10
  • 176
  • 312
Charana
  • 1,074
  • 1
  • 13
  • 26
  • Possible duplicate of [Why do functions need to be declared before they are used?](http://stackoverflow.com/questions/4757705/why-do-functions-need-to-be-declared-before-they-are-used) – NathanOliver Oct 01 '15 at 18:23
  • Possible duplicate of [warning: implicit declaration of function](http://stackoverflow.com/questions/8440816/warning-implicit-declaration-of-function) – QuestionC Oct 01 '15 at 18:23

1 Answers1

1

Move the function declaration before the main() function / or alternatively leave it where it is and simply add a function prototype before the main().

Shady Programmer
  • 794
  • 4
  • 9
  • 22