Hello this brand new noob on C is trying to take a string input of 3 words and store it on 3 different arrays, not 2D nor 3D arrays. For this problem I'm not allow to use any of the string library functions. Basically I'm trying to implement the sscanf function. I created a function that breaks the input into the three words, and stores them in their indicated array. My problem is when I try to print the each of the arrays, for my second array I can't get it to print the word I tried to store in it. I'm probably not storing anything, but I can't find my mistake. Here it's what I have...

```
#include<stdio.h>
#include<string.h>

void breakUp(char *, char *, char *, char *, int* );
int main()
{
 char line[80], comm[10], p1[10], p2[10];
 int len, n=0;

 printf("Please Enter a command: ");

 fgets(line, 80, stdin);

/* get rid of trailing newline character */
len = strlen(line) - 1;
if (line[len] == '\n')
    line[len] = '\0';

/* Break up the line */
breakUp(line, comm, p1, p2, &n);

printf ("%d things on this line\n", n);
printf ("command: %s\n", comm);
printf ("parameter 1: %s\n", p1);
printf ("parameter 2: %s\n", p2);

return 0;
}

/*
 This function takes a line and breaks it into words.
The orginal line is in the char array str, the first word
will go into the char array c, the second into p1, and the
the third into p2.  If there are no words, the corresponding
char arrays are empty.  At the end, n contains the number of
words read.
*/
void breakUp(char *str, char *c, char *p1, char *p2, int* n)
{
c[0] = p1[0] = p2[0] = '\0';
p1[0] = '\0';
int j = 0; // str array index
int i = 0; // index of rest of the arrays
n[0] = 0;

// stores first word in array c
while(str[j]!= ' '|| str[j] == '\0')
  {
      c[i]= str[j];
      i++;
      j++;
  }
// increases n count, moves j into next element
// and sets i back to index 0
if (str[j] == ' '|| str[j] == '\0')
  {
     c[i] = '\0';
      n[0]++;
      j++;
      i =0;
      if( str[j] == '\0')
          return;
  }

// stores second word in array p1
while(str[j]!= ' '|| str[j] == '\0')
{
    p1[i]= str[j];
    i++;
    j++;
}
// increases n count, moves j into next element
// and sets i back to index 0
if (str[j] == ' '|| str[j] == '\0')
{
    p1[i] = '\0';
    n[0]++;
    j++;
    i =0;
    if( str[j] == '\0')
        return;
}

// stores 3rd word in array p2
while(str[j] != ' ' || str[j] == '\0')
  {
      p2[i] = str[j];
      i++;
      j++;
  }
// increases n count, moves j into next element
// and sets i back to index 0
if(str[j] == ' ' || str[j] == '\0')
  {
      p2[i] = '\0';
      n[0]++;
      if( str[j] == '\0')
          return;

  }

}

```

Advanced thanks if any help is provided