Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 200 characters in body
Source Link
vguzmanp
  • 835
  • 1
  • 11
  • 33

You aren't allocating memory for an array, you are allocating only for one element. As

As someone said in the comments, the key is in the new Grades instruction

In addition, unless you have another i variable declared before (which is a bad practice), that code doesn't compile because (art1301 + i)->studentName = names[i]; will not find variable i

You aren't allocating memory for an array, you are allocating only for one element. As someone said in the comments, the key is in the new Grades instruction

You aren't allocating memory for an array, you are allocating only for one element.

As someone said in the comments, the key is in the new Grades instruction

In addition, unless you have another i variable declared before (which is a bad practice), that code doesn't compile because (art1301 + i)->studentName = names[i]; will not find variable i

Source Link
vguzmanp
  • 835
  • 1
  • 11
  • 33

You aren't allocating memory for an array, you are allocating only for one element. As someone said in the comments, the key is in the new Grades instruction