Код: Выделить всё
#include "stdafx.h"
#include "string.h"
#include "stdio.h"
void razbit(char *str,char slova[30][11],int *nn);
void sort(char *str);
int _tmain(int argc, _TCHAR* argv[])
{
char s[350] = {"fesa,tre,qwrp,kjfo,aks,ptfgdr,odjhf,bckjd,abgfs.\n"};
char slova[30][11];
int i, n = 30;
gets(s);
razbit(s, slova, &n);
return 0;
}
void razbit(char*str,char slova[30][11],int *nn)
{
int n,i,j;
char *s, *p = str;
n = *nn;
for(;*p != '.' ;)
{
while((*p != '.') && (*p == ','))
p++;
s = p;
if (*s != '.')
{
p = strstr(s, ",");
if (p == NULL)
p = strstr(s, ".");
j = p - s;
strncpy(slova[n], s, j);
slova[n][j]='\0';
n++;
}
}
*nn = n;
}