Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# include # include //San Marcos College //CS134 void getY (int x[], int h[], int y[], int lenX , int lenH , int lenY );

# include # include

//San Marcos College

//CS134 void getY (int x[], int h[], int y[], int lenX , int lenH , int lenY ); int main (int argc , char * argv []) { int h[] = {5 ,1 ,0 , -1 , -5}; int x[] = { -5 , -1 ,1 ,5}; int i,lenX , lenH , lenY ; lenX = sizeof (x)/ sizeof (int ); lenH = sizeof (h)/ sizeof (int ); lenY = lenX + lenH - 1; //G+U -1 int * y = malloc ( lenY * sizeof (int)); getY (x, h, y, lenX , lenH , lenY ); // display matrix y printf (" "); for (i=0; i< lenY ; i++) printf (" %d" , y[i]); // REPEAT int h2 [] = {5 ,4 ,3 ,2 ,1 , 0, -1}; int x2 [] = { -5 , -4 , -3 , -2 ,0 ,1}; lenX2 = sizeof (x2)/ sizeof (int); lenH2 = sizeof (h2)/ sizeof (int); lenY = lenX2 + lenH2 - 1; //G+U -1 return 0; } void getY (int x2 [], int h2 [], int y[], int lenX2 , int lenH2 , int lenY ) { // i'm stuck }

I only have 2 questions: how do I flip the arrays int h[ ] = {5 ,1 ,0 , -1 , -5}; and int x[ ] = { -5 , -1 ,1 ,5}; to make int x [ ] {5,1,-1,-5} and int h [ ]{-5 , -1 , 0, 1, 5} and 2. how do i make a 2d matrix size of g+u -1 THIS is in C programming. What I want to store in y is the matrix y from within the getY, basically calculate the matrix which is y from within getY()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions