I started learning the C programming language a little while ago and I'm having a hard time.
I declare a vector of strings, step values for that vector, and then pass that same vector as an argument to a function. The problem is here, when I run the program and the moment I pass the string vector as an argument, it simply stops working.
Here's an example code, to see how I'm doing:
#include <stdio.h>
#include <stdlib.h>
void MostraTodos(char memoria[]);
int main(int argc, char *argv[]) {
char memoria[3][30];
int i;
for(i=0;i<3;i++){
printf("Introduza o seu nome\n");
scanf("%s", &memoria[i]);
}
MostraTodos(memoria);
return 0;
}
void MostraTodos(char memoria[]){
int i;
for(i=0; i<3; i++){
printf("%s", memoria[i]);
}
}
I've researched a lot and I can not find the answer, but I think it's easy to solve.