Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "blank.h"
- #include "boolean.h"
- int main()
- {
- bool result = blank("");
- printf("%dn", result);
- return 0;
- }
- // Header file for blank function
- bool blank(char string[]);
- #include "boolean.h"
- #include "blank.h"
- #include <regex.h>
- bool blank(char string[])
- {
- regex_t regex_blank;
- int blank = regcomp(®ex_blank, "[:blank:]", 0);
- blank = regexec(®ex_blank, string, 0, NULL, 0);
- if ( string == NULL || blank == 1 )
- return true;
- else
- return false;
- }
- // Boolean
- // Define true
- #ifndef true
- #define true 1
- #endif
- // Define false
- #ifndef false
- #define false 0
- #endif
- typedef int bool;
- gcc Test.c blank.c -o b
- In file included from Test.c:2:0:
- blank.h:3:1: error: unknown type name ‘bool’
- blank.c: In function ‘blank’:
- blank.c:11:46: error: ‘NULL’ undeclared (first use in this function)
- blank.c:11:46: note: each undeclared identifier is reported only once for each function it appears in
- gcc Test.c blank.c -o b
- gcc *.c
- #ifndef BLANK_H_INCLUDED
- #define BLANK_H_INCLUDED
- bool blank(char string[]);
- #endif
- // Header file for blank function
- #include "boolean.h"
- bool blank(char string[]);
- #ifndef BLANK_H
- #define BLANK_H 1
- // Header file for blank function
- bool blank(char string[]);
- #endif
Add Comment
Please, Sign In to add comment