我有几个char(array),int和double类型的变量.有没有办法确定它们在运行时的类型?
例如,我正在寻找类似的东西:
int dummyInt = 5;
double dummyDouble = 5.0;
dummyInt == int ?
printf("yes, it's of int type\n") : printf("no, it's not of int type\n");
dummyDouble == int ?
printf("yes, it's of int type\n") : printf("no, it's not of int type\n");
Run Code Online (Sandbox Code Playgroud)
显而易见的结果将是:
是的,它是int类型
否,它不是int类型
好吧,我需要它的原因是因为我将数据从变量传输到SQL数据库(使用SQLite).现在,每次运行程序时标头都会改变,具体取决于使用的变量.因此,当我创建表时,我需要告诉它是否为VARCHAR,INTEGER,DOUBLE等.