Ayush
Ayush

Reputation: 42450

"gcc -o test test.c; test" does not produce any output

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?

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

gcc -o test test.c
test > output

I always end up with output being an empty file.

Upvotes: 2

Views: 774

Answers (1)

karlphillip
karlphillip

Reputation: 93468

test is also a command line application:

test - check file types and compare values

The proper way of executing your little app would be:

./test > output

Upvotes: 4

Related Questions