Sort by

recency

|

741 Discussions

|

  • + 0 comments

    Here is Printing Tokens in C problem solution - https://programmingoneonone.com/hackerrank-printing-tokens-solution-in-c.html

  • + 0 comments

    include

    include

    include

    include

    int main() {

    char *s;
    s = malloc(1024 * sizeof(char));
    scanf("%[^\n]", s);
    s = realloc(s, strlen(s) + 1);
    //Write your logic to print the tokens of the sentence here.
    

    char *word = strtok(s, " "); while(word != NULL) { printf("%s\n", word); // Print each word in new line word = strtok(NULL, " "); // Move to next word } return 0; }

  • + 0 comments

    int main() {

    char *s;
    s = malloc(1024 * sizeof(char));
    scanf("%[^\n]", s);
    s = realloc(s, strlen(s) + 1);
    for(int i = 0;s[i]!='\0';i++){
        if(s[i] ==' '){
            s[i] = '\n';
        }
    }
    printf("%s",s);
    
    free(s);
    return 0;
    

    }

  • + 0 comments

    It’s widely used for systems programming, embedded systems, and building performance-critical applications. Skysetx

  • + 0 comments

    int i;
    for (i=0; s[i]!='\0'; i++) s[i] == ' ' ? printf("\n"): printf("%c",s[i]);
    return 0;