+ 3
Who knows how to pass char [] to a function?
For example: https://code.sololearn.com/ctpRpn7qal74/?ref=app
8 Answers
+ 1
"A string literal is an array of n constant characters" -> Declare a as const.
You can also use a pointer, since an array is technically a reference to the address of it's first element. Example below
https://code.sololearn.com/cSInynO7rFB3/?ref=app
+ 2
Yes, but I see now))) Thinks
+ 2
The example is very good, but the link was not immediately. Now I see, thank you very much
+ 1
String type data? Are you sure?
+ 1
Problem: the vstudio compiler writes an error
+ 1
"A string literal is an array of n constant characters" -> Declare a as const.
You can also use a pointer, since an array is technically a reference to the address of it's first element.
It's I understand this, but... Ńan you give a simple example?
+ 1
Andrey Stepanov an example for char array? The one above is pretty simple.
Is there any part that are confusing? I'll give my best to explain.
0
You are passing a string not a character.
You could use a character array or string type data.
include string header to use it.
https://code.sololearn.com/cNaFLxtqrcdW/?ref=app