>for(i =0; i<=3; ++i)
That's not 3 strings, that's 4 strings. Make it:
Code:
for(i =0; i<3; ++i)
> char *words[24]; /*declare an array of pointers*/
This doesn't declare any memory for the actual string, it just declares 24 pointers. Either make this an array of strings:
Code:
char words[24][40]; /*declare an array of 24 strings*/
Or allocate space for each string:
Code:
#include <stdio.h>
#include <string.h>
.
.
char *words[24]; /*declare an array of pointers*/
char temp[100];
.
.
for(i =0; i<3; ++i)
{
scanf("%s", &temp);
notes[i] = malloc(strlen(temp)+1);
strcpy(notes[i], temp);
}
And your declaration is called words, but your loop refers to notes.