Most of your stuff is right, but you've got a lot of typos (as others have said, C is case sensitive). Also, if your function doesn't modify your struct (if it only reads it), you don't need to pass a pointer to the struct. Not sure if the SumVector float->int thing was intended.
Here's a slightly modified but working version:
Code:
#include <stdio.h>
#include <stdlib.h>
struct Vector {
int size;
float *data;
};
void AllocVector (struct Vector *VP, int n)
{
VP->size = n;
VP->data = malloc(n * sizeof(float));
if(VP->data == NULL)
{
fprintf(stderr, "Memory allocation failed\n");
exit(1);
}
}
void FreeVector (struct Vector *VP)
{
free (VP->data);
}
float SumVector (struct Vector v)
{
float sum = 0;
int i;
for (i=0; i < v.size; i++)
sum += v.data[i];
return sum;
}
int main(void)
{
struct Vector v1;
const int N = 2;
float sum;
AllocVector(&v1, N);
v1.data[0] = 3.14;
v1.data[1] = 3.15;
sum = SumVector(v1);
FreeVector(&v1);
printf("The sum of the vector is %.2f\n", sum);
return 0;
}