When populating a char Array with a word like 'school', do you have to do it 1 character at a time with something like a FOR loop, or is there an easier way like
I know the code is wrong but I used it as an example to show what I was thinking. I am learning that part of the book right now and I am trying my own tests to grasp it better.
The book is teaching how to populate from a keyboard input. My question is what if I already have a word like 'school' and just want an char array from that.
Thanks.
-Lars
Code:
char word[6];
*word = 'School';
printf("The word is %s", word);
I know the code is wrong but I used it as an example to show what I was thinking. I am learning that part of the book right now and I am trying my own tests to grasp it better.
The book is teaching how to populate from a keyboard input. My question is what if I already have a word like 'school' and just want an char array from that.
Thanks.
-Lars
Last edited: