9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia03/ex02.c (346B)
   1 #include <stdio.h>
   2 #include <string.h>
   3 
   4 #define MAX_LEN 100
   5 #define ERR_EMPTY_MSG "no chars have been readed"
   6 
   7 int main(void) {
   8     
   9     char s[MAX_LEN];
  10 
  11     if(!fgets(s, MAX_LEN, stdin)) {
  12         fprintf(stderr, ERR_EMPTY_MSG"\n");
  13         return 1;
  14     } else if(!strcmp(s, "")) {
  15         fprintf(stderr, ERR_EMPTY_MSG"\n");
  16         return 1;
  17     }
  18 
  19     printf("%s", s);
  20     return 0;
  21 }