0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cf1.c, The C Puzzle Book

Last updated at Posted at 2025-05-28
cf1.c
#include "defs.h"

void main(){
        int x, y=1, z;

        if( y!=0 ) x=5;
        PRINT1(d,x);            //Control Flow 1.1

        if( y==0 ) x=3;
        else x=5;
        PRINT1(d,x);            //Control Flow 1.2

        x=1;
        if( y<0 ) if( y>0 ) x=3;
        else x=5;
        PRINT1(d,x);            //Control Flow 1.3

        if( z=y<0 ) x=3;
        else if( y==0 ) x=5;
        else x=7;
        PRINT2(d,x,z);          //Control Flow 1.4

        if( z=(y==0) ) x=5; x=3;
        PRINT2(d,x,z);          //Control Flow 1.5

        if( x=z=y); x=3;
        PRINT2(d,x,z);          //Control Flow 1.6
}
defs.h
// https://qiita.com/kaizen_nagoya/items/6d284651ac1244963bd9
// Type by Dr. Kiyoshi Ogawa
#include <stdio.h>

#define PR(format, value) printf("value = %" format "\t", (value))
#define NL putchar('\n')

#define PRINT1(f, x1) PR(f, x1), NL
#define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
#define PRINT3(f, x1, x2, x3) PR(f, x1), PRINT2(f, x2, x3)
defs.h

bash
In file included from cf1.c:1:
cf1.c: In function ‘main’:
cf1.c:7:16: error: expected ‘)’ before ‘d’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:11:16: error: expected ‘)’ before ‘d’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:16:16: error: expected ‘)’ before ‘d’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:21:16: error: expected ‘)’ before ‘d’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:21:16: error: expected ‘)’ before ‘d’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:24:16: error: expected ‘)’ before ‘d’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:24:16: error: expected ‘)’ before ‘d’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:27:16: error: expected ‘)’ before ‘d’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:27:16: error: expected ‘)’ before ‘d’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
inst19@teachB:~$ :q
:q: command not found
inst19@teachB:~$ gcc cf1.c
In file included from cf1.c:1:
cf1.c: In function ‘main’:
cf1.c:7:16: error: expected ‘)’ before ‘d’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:11:16: error: expected ‘)’ before ‘d’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:16:16: error: expected ‘)’ before ‘d’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:21:16: error: expected ‘)’ before ‘d’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:21:16: error: expected ‘)’ before ‘d’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:24:16: error: expected ‘)’ before ‘d’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:24:16: error: expected ‘)’ before ‘d’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:27:16: error: expected ‘)’ before ‘d’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:9:27: note: in expansion of macro ‘PR’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                           ^~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                           ^
cf1.c:27:16: error: expected ‘)’ before ‘d’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                ^
defs.h:5:46: note: in definition of macro ‘PR’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                              ^~~~~~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:33: note: to match this ‘(’
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                 ^
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:34: warning: spurious trailing ‘%’ in format [-Wformat=]
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |                                  ^~~~~~~~~~~
defs.h:8:23: note: in expansion of macro ‘PR’
    8 | #define PRINT1(f, x1) PR(f, x1), NL
      |                       ^~
defs.h:9:38: note: in expansion of macro ‘PRINT1’
    9 | #define PRINT2(f, x1, x2) PR(f, x1), PRINT1(f, x2)
      |                                      ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:5:43: note: format string is defined here
    5 | #define PR(format, value) printf("value = %" format "\t", (value))
      |       
bash
In file included from cf1.c:1:
cf1.c: In function ‘main’:
cf1.c:7:19: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |                   ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
cf1.c:7:9: note: in expansion of macro ‘PRINT1’
    7 |         PRINT1(d,x);            //Control Flow 1.1
      |         ^~~~~~
In file included from defs.h:5:
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
cf1.c:11:19: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |                   ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
cf1.c:11:9: note: in expansion of macro ‘PRINT1’
   11 |         PRINT1(d,x);            //Control Flow 1.2
      |         ^~~~~~
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
cf1.c:16:19: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |                   ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
cf1.c:16:9: note: in expansion of macro ‘PRINT1’
   16 |         PRINT1(d,x);            //Control Flow 1.3
      |         ^~~~~~
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
cf1.c:21:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
cf1.c:21:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:21:9: note: in expansion of macro ‘PRINT2’
   21 |         PRINT2(d,x,z);          //Control Flow 1.4
      |         ^~~~~~
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
cf1.c:24:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
cf1.c:24:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:24:9: note: in expansion of macro ‘PRINT2’
   24 |         PRINT2(d,x,z);          //Control Flow 1.5
      |         ^~~~~~
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
cf1.c:27:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
cf1.c:27:21: warning: format ‘%f’ expects argument of type ‘double’, but argument 2 has type ‘int’ [-Wformat=]
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |                     ^
defs.h:8:35: note: in definition of macro ‘PR’
    8 | #define PR(format, value) printf(#value" = %format\t",(value))
      |                                   ^~~~~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
defs.h:9:20: warning: passing argument 1 of ‘putchar’ makes integer from pointer without a cast [-Wint-conversion]
    9 | #define NL putchar("\n")
      |                    ^~~~
      |                    |
      |                    char *
defs.h:11:32: note: in expansion of macro ‘NL’
   11 | #define PRINT1(f,x1) PR(f,x1), NL
      |                                ^~
defs.h:12:35: note: in expansion of macro ‘PRINT1’
   12 | #define PRINT2(f,x1,x2) PR(f,x1), PRINT1(f,x2)
      |                                   ^~~~~~
cf1.c:27:9: note: in expansion of macro ‘PRINT2’
   27 |         PRINT2(d,x,z);          //Control Flow 1.6
      |         ^~~~~~
/usr/include/stdio.h:618:25: note: expected ‘int’ but argument is of type ‘char *’
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
$ gcc cf1.c
$ ./a.out
x = 5
x = 5
x = 1
x = 7   z = 0
x = 3   z = 0
x = 3   z = 1
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?