0

I have this code

#include <stdio.h>
int addthree(int x);

int main()
{          int num; int d = 0; 
            printf("enter ur num");
            scanf("%d", &num);
            d = addthree(num);

return 0;
}


int addthree(int x)

{
        int s = 0;
        s = x +3;
        return s;
     }

Okey I want this code in different way. I want it in three files. A Header file lucky.h which defines prototype of addthree function
a file add-three.c which implement the addthree function
a file solution.c which included the program's main function

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Narue
0

the enviroment am working with is fedora unix.


Anyone has good place to also understand the ar(1) stuff???

i need to use that utility to package the object file add-three.o into library file libmy-string.a
i will use the librya along with solution. o file to generate the program exectuable file

0

>I want it in three files.

/* lucky.h */
int addthree(int x);
/* add-three.c */
#include "lucky.h"

int addthree(int x)
{
  int s = 0;
  s = x +3;
  return s;
}
/* solution.c */
#include "lucky.h"

int main()
{
  int num; int d = 0; 

  printf("enter ur num");
  scanf("%d", &num);
  d = addthree(num);

  return 0;
}

>Anyone has good place to also understand the ar(1) stuff???
Is the man page not helpful?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.