0

Hello I´m trying to copy a char from a structure. So I have the structure

char Person[50]
typedef struct {
char Name[50] = "Hello";
int Date;
float Times86;
}NewName;

How can I copy the Hello out of the structure into a normal char. If I do

Person = NewName.Name

The Errorassignment to expression with array type appears

Nikosg
  • 11

2 Answers2

0

This should do the job

NewName newname_var;
memcpy(Person, newname_var.Name, sizeof(newname_var.Name));
Breakpoint
  • 428
  • 6
  • 19
-1

You created array of chars with Person[50], try changing that into char Person;

  • Thanks for the answer but now I have the Error "assignment makes integer from pointer without a cast" – Nikosg Jan 12 '20 at 19:18