It says That I am getting a syntax error and I can't see what it is? I am deviating from the book with some tests to make sure I understand this before I move on. I am trying to pass a struct pointer as a parameter to my function .Then try to populate the char array 'words' in the struct with the char string 'Hello'.Then back in main I am trying to write the word out to the console. (I wrote out what I was trying to do so I could also see if my grammar was correct in stead of just saying I was getting a syntax error). The only thing I just thought of before I post this message is that I might need to populate the char with a for loop 1 letter at a time?
Header file
main.c
Header file
Code:
#define kMaxList 50
#define kMaxNumber 10
struct larsList
{
char words[kMaxList];
char list[kMaxNumber];
};
main.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dvdTest.h"
void printStuff(struct larsList *myList);
int main (int argc, const char * argv[]) {
struct larsList myList;
printStuff(&myList);
printf("The word is: %s", myList.words);
return 0;
}
void printStuff(struct larsList *myList)
{
myList->words[kMaxList] = {'H','e','l','l','o','\0'};
}