reate data type VECTOR in c
Step 1: Write the following code in the file vector.h
//vector.h
typedef struct vect{
int i;
int j;
}VECTOR;
VECTOR add_vect(VECTOR x,VECTOR y){
VECTOR sum;
sum.i=x.i+y.i;
sum.j=x.j+y.j;
return sum;
}
void print(VECTOR z){
printf("%di+%dj",z.i,z.j);
}
Step 2: Now by including vector.h you can use VECTOR data type
No comments:
Post a Comment