C programming
1. Create a file function.c that contains a function called
printNumbers() that prints the numbers 1 to 15.
2. Create a file function.h that contains the prototype for the printNumbers()
function.
3. Create a file main.c that contains a main function that calls the
printNumbers() function. You will need to be sure to include the header file.
4. Use gcc to compile the entire program (all files) without warnings.
5. Run the program and make sure that it prints the numbers 1 to 15.
/* function.h */
#ifndef MY_FUN
#define MY_FUN
/*function declarations*/
void printNumbers();
#endif
/* function.c */
#include"function.h"
void printNumbers(){
int i;
for(i = 1; i <=15 ; i++){
printf("%d\n",i);
}
}
/* main.c */
#include <stdio.h>
#include <stdlib.h>
#include"function.h"
int main(int argc, char *argv[]) {
printNumbers();
return 0;
}
/* OUTPUT */
/* PLEASE UPVOTE */
Get Answers For Free
Most questions answered within 1 hours.