討論串[問題] printf type of value
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
模仿上一篇文,用 macro 來做,但是改用 C11 的 _Generic,. 這樣也能解決 long long 的問題。. #include <stdio.h>. #define FORMAT(x) \. _Generic((x), \. int: "type = int, data = %d\n
(還有475個字)
內容預覽:
C 語言的話應該只能暴力解了.... 還好你的情境應該只會用在 primitive type 上. 如果沒有用到兩個 keyword 以上的型態 (例如 long long). 那應該可以這麼做:. #define DATATYPE XXX. /* 更多就再加 */. #define FORMAT_
(還有738個字)
內容預覽:
#include <stdio.h> /*printf*/. typedef struct _OGC{. int list;. char* string;. }OGC;. OGC OGC_TABLE[]={. {1,"int"},. {2,"float"}. {3,"OGC"},. };. char
(還有297個字)
內容預覽:
開發平台(Platform): (Ex: VC++, GCC, Linux, ...). GCC. 請問在c底下我要怎麼print出我變數的type. 例如說. int a;. float b;. char c;. 我希望能print出. typeof(a)=int;. typeof(b)=floa
(還有107個字)
首頁
上一頁
1
下一頁
尾頁