Whats wrong with the following code

Whats wrong with the following code

I have written down a code in C++ to make the words appear in array from a
string input. But it doesn't works due to overflow or something. Compiler
doesn't show any error though.
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
char a[100];
gets(a);
char b[100][100];
int I=0;
for(int j=0;j<strlen(a);j++) //runs the loop for words
{
int k=0;
do
{
b[I][k]=a[j];
k++;
}
while(a[j]!=' ');
I++;
}
cout<<b[0][0];
return 0;
}