C
chellappa
hi Everybody !
decalaring variable in a.h and using that vaaariable in a1.c and
inalization is in main.c it is possible .........pleaase correct that
error
is it Possible? i am trying it gives error!
In file included from main.c:2:
a1.c:3: error: initializer element is not constant
a1.c:4: error: variable-size type declared outside of any function
if possible ,please correct it
a.h
====
extern int a;
void store();
main.c
========
#include<stdio.h>
#include "a1.c"
int main(void)
{
a=10;
}
a1.c
=======
#include<stdio.h>
#include "a.h"
int size=a;
int ar[size];
void store()
{
int i=0;
for (i=0;i<a;i++)
{
ar=i;
}
}
1) decalaring variable in a.h and using that vaaariable in a1.c and
inalization is in main.c it is possible .........pleaase correct that
error
please correct i am trying.. .this is intialise array using global
variable
Thanks u
decalaring variable in a.h and using that vaaariable in a1.c and
inalization is in main.c it is possible .........pleaase correct that
error
is it Possible? i am trying it gives error!
In file included from main.c:2:
a1.c:3: error: initializer element is not constant
a1.c:4: error: variable-size type declared outside of any function
if possible ,please correct it
a.h
====
extern int a;
void store();
main.c
========
#include<stdio.h>
#include "a1.c"
int main(void)
{
a=10;
}
a1.c
=======
#include<stdio.h>
#include "a.h"
int size=a;
int ar[size];
void store()
{
int i=0;
for (i=0;i<a;i++)
{
ar=i;
}
}
1) decalaring variable in a.h and using that vaaariable in a1.c and
inalization is in main.c it is possible .........pleaase correct that
error
please correct i am trying.. .this is intialise array using global
variable
Thanks u