How to declare an array in a function and call the function in C -
i have assignment , cannot figure out part.
the assignment requires create 2 separate functions , call them in main. question syntax calling pointer array , how call function in main program? example,
int function_1(int x, *array);
how call function_1
? or lost here?
i should add anytime try , call function array, error: [warning] assignment makes pointer integer without cast [enabled default]
int function(int x, char *array) { //do work return 0; }
and in main
int main() { char arr[5] = {'a', 'b', 'c', 'd'}; int x = 5; function(x, &arr[0]); return 0; }
Comments
Post a Comment