char s[]="This is C programming text",怎样将其存放在数组a[5][20]中,
其中a[i]放入一个单词。
#include<stdio.h>
#define ROW 5
#define COLUMN 20
int main()
{
    char s[]="This is C programming text";
    char a[ROW][COLUMN];
    char * p_s,(*p_arr)[COLUMN];
    int row,column;
    
    p_s=s;
    for(row=0;row<5;row++)
    {
        column=0;
        while(*p_s!=' ' && *p_s!='\0')
        {
            a[row][column]=*p_s;
            p_s++;
            column++;
        }
        if(column<COLUMN)//putting '\0' at the end ofthe row of the array
            a[row][column]='\0';
        p_s++;
    }
    
    //printf the array
    p_arr=a;
    for(;p_arr<a+column;p_arr++)
        printf("%s\n",p_arr);    
    getchar();
    return 0;
}
//dev-c++,gnu compiler



 
											





 
	    

 
	





