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

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

>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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.