Suppose that we have two C arrays int x10 int y10 Why wont t

Suppose that we have two C arrays:

int x[10];

int y[10];

Why won\'t the assignment x = y compile in C? Can the declarations be fixed so the assignment will work?

Solution

x = y this expression will throw error. WE cannot use the assignment in array like this.

if you want to assign the value like this then dont use x and y as array.

if you want x and y as array then to assign value of y in x you need to assign the value at array x each position from each position of array y.

example: x[5] = y[5];

Suppose that we have two C arrays: int x[10]; int y[10]; Why won\'t the assignment x = y compile in C? Can the declarations be fixed so the assignment will work

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site