Strings in the structure

struct myStructure {
  int myNum;
  char myLetter;
  char myString[30]; // String
};
int main() {
  struct myStructure s1;
  strcpy(s1. myString, "Some text");
  // print value
  printf("my string: %s", s1.myString);
  return 0;
}

Assigning values ​​to strings using the strcpy function

Comments