#include <stdio.h>
void copyArray (int srcArray[], int srcSize, int dstArray[], int dstSize);
int main(int argc, char **argv) {
int i = 0;
int srcSize;
int srcArray[15];
int dstSize;
int dstArray[15];
int c=0;
//Enter array sizes
printf("Enter the source size: ")...
The program doesnt allow me to input anything into the array.
It goes straight to printing the source array and skips the while loop entirely.
I dont get what im doing wrong.
I fixed up the loops thanks for the help. If I wanted to stop when the user has inputed the data they want how would I do that? I tried to do this code but for some reason my c is automatically equaling new line.
while (c != '\n') {
c = getchar();
if (i < srcSize) {
srcArray[i] =...
My attempt is a screw up. I dont know where to set the size of the arrays. I dont know how to use functions properly either.
#include <stdio.h>
void copyArray (int srcArray[], int srcSize, int dstArray[], int dstSize);
int main(int argc, char **argv) {
int i = 0;
int srcSize;
int...
I need to copy one array into a different array using a function.
However, if the source array has less elements than the destination array,the remaining elements in the destination array should be set to 0.
If the source array is bigger than the destination array, I need to copy only as much...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.