P
pereges
/* a.h */
#include <stdio.h>
#include <stdlib.h>
extern int *a;
/*a.c */
#include "a.h"
#include "b.h"
int *a = NULL;
int main(void)
{
call(a);
print(a);
return 0;
}
void call(int *);
void print(int *);
/* b.h */
void call(int *);
void print(int *);
/* b.c */
#include "a.h"
#include "b.h"
int n = 5;
void call(a)
{
a = calloc(sizeof(int), n);
a[0] = 0;
a[1] = 2;
a[2] = 7;
a[3] = 9;
a[4] = 90;
}
void print(a)
{
int i;
for(i=0; i<n; i++)
printf("%d\n",a);
}
I'm getting an error saying "Conflicting argument declarations for
function 'call'. " in b.c
Why am I getting an error if a was declared as extern and defined in
a.c ?
#include <stdio.h>
#include <stdlib.h>
extern int *a;
/*a.c */
#include "a.h"
#include "b.h"
int *a = NULL;
int main(void)
{
call(a);
print(a);
return 0;
}
void call(int *);
void print(int *);
/* b.h */
void call(int *);
void print(int *);
/* b.c */
#include "a.h"
#include "b.h"
int n = 5;
void call(a)
{
a = calloc(sizeof(int), n);
a[0] = 0;
a[1] = 2;
a[2] = 7;
a[3] = 9;
a[4] = 90;
}
void print(a)
{
int i;
for(i=0; i<n; i++)
printf("%d\n",a);
}
I'm getting an error saying "Conflicting argument declarations for
function 'call'. " in b.c
Why am I getting an error if a was declared as extern and defined in
a.c ?