11 AnswersNew Answer
a is an array of 5 arrays You can refer to the first one like that: &a That is a pointer to the first element of the first array, or even like that: a because the name of an array is a pointer to it's first element. If you write &a you have a pointer to the first element of your array of arrays, i.e. a pointer to a pointer to char. But %s is expecting just a pointer to char
Same reason, a is already an address, & a asks for the address of an address, and so it gives you a warning
scanf("%s") needs a memory address. a is a variable that holds a memory address a gives a value, that value is the memory address of your array &a gives a memory address, the memory address of a. So, scanf("%s", a) puts %s in the array scanf("%s", &a) puts the %s in a variable that is supposed to hold a memory address, not %s So it gives you error
Thank you very much Davide 😊
You are welcome 🤗
a is the name of the 2D array a is the name of the first array of the 2D array Since an array name is a pointer to its first element, a = &a and a = &a scanf("%d", a); is the same of: scanf("%d", &a); You can't do that, a is a pointer to a pointer to int, but %d expects a pointer to int what you can do is scanf("%d", a); that is like: scanf("%d", &a);
Thank you very much Davide 😊😃
Thank you very much Angelo 😊 But can you tell me,what is the meaning of warning, displayed in console....
Thank you Angelo 😊
Davide and Angelo ,I have a another doubt😅Can you tell me , what does the "a" indicates in this below function...... I mean,it point's to,arrays which first element? scanf("%d",a);//in two dimensional array And also tell me difference between a && a in two dimensional array.....