-2
#include<stdio.h>
int main(void)
{
int a;
int count=0;

for(a=1;a<=10;a=a+1)
     {
     if(a>3)
         count=count+1;
     }
 printf("%d numbers were greater than 3\n",count);

 return 0;
}    

why have the error of ERROR: variable 'file name' not defined ERROR: command 'file name' not found ERROR: cannot execute program 'file name'

cas
  • 78,579

1 Answers1

2

In Unix, the executable programs aren't searched for in the current directory, to avoid security risks due to inadvertently running the wrong program.

You have to do e.g.

cc pgm.c -o pgm
./pgm

to run your program (./ specifically asks to run the executable in the current directory, it doesn't rely on the shell searching for a program called pgm).

vonbrand
  • 18,253