Arrays as function arguments :(
Hi All!!!
My task is...
"Write a function that adds the elements of two one-dimensional arrays of same size. The results should be stored in a third function. The function should take as arguments the name of the three arrays and the array dimensions.
Write a simple program that uses the function. The two arrays should be declared at the beginning of the program (in the main function block)"
This is my code so far...
Code:
#define _CRT_SECURE_NO_DEPRECATE
#include<stdio.h>
#include<string.h>
main()
{
char first[31];
char second[31];
char name[62];
printf("Please enter your first name(s): ");
scanf("%[^\n]", first);
printf("Please enter you surname(s): ");
fflush(stdin);
scanf("%[^\n]", second);
strcpy(name, first);
strcat(name, " ");
strcat(name, second);
printf("Your full name is %s", name);
}
I have tried for ages but I cannot arrange my code in to the specified function as the task requires.
Can anyone please help??
Thanks in advance
Stuart