C - No output data -
i have problem source code. when this, have no output data, why ? how can resolve please ? 
 thank's !
#include <stdlib.h> #include <stdio.h> #include <string.h>  void ft_split_whitespaces(char *str);  int main(int argc, char** argv) {     ft_split_whitespaces("hello\nthis is\ta\nword");     return (0); }  void ft_split_whitespaces(char *str) {     int i;      (i = 0; str[i] != '\0'; ++i);     {         if (str[i] == '\n' || str[i] == '\t' || str[i] == ' ')         {             printf("ascii table (int): %d, ascii table (char): %c\n", str[i], str[i]);         }     } }      
typographical error - semicolon @ end of for means empty statement - for (i = 0; str[i] != '\0'; ++i);.
fix: remove semicolon , never put 1 instead of empty statement @ end of for/while/if - use { /* intentionally empty */} instead 
for (i = 0; str[i] != '\0'; ++i) // no semicolon here ever. {     if (str[i] == '\n' || str[i] == '\t' || str[i] == ' ')     {         printf("ascii table (int): %d, ascii table (char): %c\n", str[i], str[i]);     } }      
Comments
Post a Comment