I have tried it but not getting what i want to display on screen
C:
int main(void)
{
LCD_init();
string ();
while (1)
{
}
}
You NEED to tell us what you want to see. You have not told us. You also NEED to tell us what you got with the above code and what was wrong with it. We can't tell you anything since we don't know what you are getting and we don't know what it is that you want.
Also, stop saying calling it a "string array" or an "array of strings". That is completely different. What you are talking about is a "string" or an "array of characters". Unless you actually are talking about an array of strings. What is it that you want? Because you seem to be talking about only one string, but you keep saying "array of strings" as well as
How to pass n string's as argument in function?
Are you talking about a string or array of characters that is n elements long? Or are you actually talking about an array of n array of characters?
Also, do not give your functions and array the same name string() and string[]. That's really bad practice. Give them different names. Give them real names. The only reason it is compiling here is that the variable is declared local to the function. Don't do it.
You pass a string, or an array of characters to a function like this:
Code:
void MyFunction(char InputText[]);
or
Code:
void MyFunction(char *InputText);
They can be used *almost* interchangeably. The main times you cannot use them interchangeably are when you do anything that needs to know the size of the array or it's elements such as when you use the sizeof() function or when you InputText++ or InputText+1 (because it needs to know to increment the address by the size of just one char element or the size of the entire array).
You call it with either any these, except the bottom one:
Code:
char MyText[15];
MyFunction(MyText);
MyFunction(&MyText);
MyFunction(&MyText[0]);
MyFunction(MyText[0]); //THIS IS WRONG because [] will dereference the address and not pass the address of the array. It will pass the value of the first element instead.