I am a beginner programmer, I am doing homework and I ran into a problem with undefined reference.
I have 1 header and two sorce files:
main.c, utils.c, utils.h
I am supposed to write a function to check prime numbers from 16 to 235 in utils.c and call the function in main.c.
main.c:
#include <stdio.h>
#include <stdlib.h>
#include "utils.h"
int main()
{
is_prime();
return 0;
}
utils.c
#include <stdio.h>
#include <stdlib.h>
void is_prime()
{
int i, n[220], v = 220, broj, k = 2,z = 16;
for (i = 0; i < v; i++)
{
n[i] = z++;
}
for (i = 0; i < v; i++)
{
broj = n[i];
while ((broj % k) != 0 && k < broj) k++;
if (k == broj) printf("%d ", i, n[i]);
k = 2;
}
}
utils.h
#ifndef UTILS_H_INCLUDED
#define UTILS_H_INCLUDED
void is_prime();
#endif // UTILS_H_INCLUDED