Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Function to fund size of string and index spaces
- int getSpace(char str[])
- {
- int n, i, count;
- n=strlen(str);
- count = 0;
- int k[n];
- for(i=0; i<n;i++)
- {if (str[i]==' '){
- count++;
- k[count]=i;
- printf("\n %d \n",k[count]);
- }
- }
- return(k[n], count);
- }
- //Main for testing getSpace
- main()
- {
- char s[]="testing this out and seeing how it goes";
- int numSpace = getSpace(s);
- printf("\n %d \n",numSpace);
- system ("pause");
- }
- //Separate crap trying to get other to work - still working on
- #define N_MAX 1000
- main()
- {
- char s[]="testing this out and seeing how it goes";
- char s2[N_MAX];
- int n, i, j, count;
- n=strlen(s);
- count = 0;
- for(i=0; i<n;i++)
- {if (s[i]==' '){
- count++;}
- j=0;
- for(i=0; i<n;i++)
- {
- for (j=0;j<n;j++)
- {
- s2[j][i]=s[i];
- if (s[i]==' '){
- j++;
- }
- }
- }
- }
- system ("pause");
- }
Add Comment
Please, Sign In to add comment