I've written a very simple program that is meant to covert a char to its equivalent ASCII value (eg. A = 65), but I'm getting no output at all. where am i going wrong?
我编写了一个非常简单的程序,用于将char转换为其等效的ASCII值(例如A = 65),但我根本没有输出。我哪里错了?
Program: test.c
#include<stdio.h>
int main()
{
char test = 'c';
int key = (int)(test);
printf("%d",key);
return 0;
}
Bash script to compile and run
用于编译和运行的Bash脚本
gcc -o test test.c
test > output
I always end up with output being an empty file.
我总是以输出为空文件结束。
1 个解决方案
#1
4
test is also a command line application:
test也是一个命令行应用程序:
test - check file types and compare values
test - 检查文件类型并比较值
The proper way of executing your little app would be:
执行小应用程序的正确方法是:
./test > output
./test>输出
#1
4
test is also a command line application:
test也是一个命令行应用程序:
test - check file types and compare values
test - 检查文件类型并比较值
The proper way of executing your little app would be:
执行小应用程序的正确方法是:
./test > output
./test>输出