double *b;
//fction allocation memoire: (permet d'allouer pas obligatoirement à partir de b[0] mais d ou on veut:
double *dvector(int nl,int nh)
{
double *v;
v=(double *)malloc((unsigned)(nh-nl+1)*sizeof(double));
if(!v) return NULL;
v=v-nl;
return v;
}
//fction reallocation memoire:
double *realldvector(double *b,int size)
{
b=(double *)realloc(b,(unsigned)(size)*sizeof(double));
if(!b) return NULL;
return b;
}
int main()
{
if((b=dvector(1,1))==NULL)
{
printf("Memory Allocation failure");
exit(1);
}
if((b = realldvector(b,5))==NULL)
{
printf("Memory Allocation failure");
exit(2);
}
}
ca ne marche pas s y jaloue au depart mon vecteur à partir de b[1] et non b[0] POURQUOI et comment faire???????