9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia05/ex19.c (528B)
   1 #include <stdio.h>
   2 #include <string.h>
   3 #include <stdlib.h>
   4 
   5 typedef enum { TRUE, FALSE } bool_t;
   6 
   7  
   8 bool_t is_empty_string(const char *); 
   9  
  10 int main (void)
  11 {
  12     char str[] = "Hello";
  13     char str_empty[] = "";
  14 
  15     printf("%s\n", str);
  16     printf("La cadena %s vacia\n", is_empty_string(str) ? "no esta" : "esta");
  17 
  18     printf("%s\n", str_empty);
  19     printf("La cadena %s vacia\n", is_empty_string(str_empty) ? "no esta" : "esta");
  20 
  21     return 0;
  22 }
  23 
  24 bool_t is_empty_string(const char *str)
  25 {
  26     if(!strcmp(str, ""))
  27         return TRUE;
  28 
  29     return FALSE;
  30 }