Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codigo #2

Open
quemuel opened this issue Nov 9, 2013 · 0 comments
Open

codigo #2

quemuel opened this issue Nov 9, 2013 · 0 comments
Assignees

Comments

@quemuel
Copy link
Owner

quemuel commented Nov 9, 2013

include <stdio.h>

include <string.h>

include <strings.h>

include <malloc.h>

include <stdlib.h>

void main()
{
char texto[225] = "Localizando primeiro quemuel leal sadfasdf asdfasdfgt";

int i, j, start = 0, end, k = 0, z = 0,x=0;

char substri[3];
char substriTemp[10];
char null[10]="         ";
char matrizString[4][40];

for (i = 0; i <= strlen(texto); i++)
{

    if (texto[i] == ' ' || i == strlen(texto))
    {
        end = i;
        // printf("end - start %d - %d\n",end,start);
        if ((end - start) <= 10)
        {
            k = 0;
            strcpy(substriTemp,null);
            for (j = start; j < end; j++)
            {
            substriTemp[k] = texto[j];
                //printf("%c", substriTemp[k]);
                k++;
            }
            //printf("\n");
            //printf("%s\n", substriTemp);
                            strcpy(matrizString[z],substriTemp);
            z++;
            // printf("%s\n%d\n",substriTemp,strlen(substriTemp));
            // substri[z]=substriTemp;
        }
        start = end + 1;
    }
    // z++;
}
for (x = 0; x <= 4; x++){
printf("%s\n",matrizString[x]);
}
// printf("for");

}

@ghost ghost assigned quemuel Nov 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant