Why adress sign is not used to store data in string variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why adress sign is not used to store data in string variable?

Generally we use (& ) for storing data in variables but not for strings

10th Nov 2019, 6:26 AM
Meejuru Eswar
Meejuru Eswar - avatar
1 Answer
+ 2
Because a C string is a char array. And when an array is passed to functions, a pointer that refers to the array's first element is passed instead. Since that pointer carries an address, it is in itself sufficient. Hth, cmiiw
10th Nov 2019, 6:41 AM
Ipang