LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   No Output?? (https://www.linuxquestions.org/questions/programming-9/no-output-67003/)

fernin8r 06-21-2003 02:24 AM

No Output??
 
This is really dumb, but i'm a newbie.

here's my code. (I'm just tried to familiarize myself with the gcc compiler)

#include<math.h>
#include<stdio.h>

int main(void)
{

int a;
int b;

a = 1;
b = 2;

printf(" PLEASE");
printf("a=%2d",a);
printf("b=%2d",b);

}


HERE's what i type in

gcc ~/filename.c

i got thing to run without errors, but were do the printf statements print to? i don't see " PLEASE" or "a=1" or "b=2". am i typing something in wrong?

thanks

acid_kewpie 06-21-2003 04:01 AM

you need a new line character, \n, to flush the output buffer for you each line.

Hko 06-21-2003 05:47 AM

cd ~
gcc -o yourprog filename.c

# now you program is compiled to the "yourprog" executable.
# and you need to run that to see some output

./yourprog

acid_kewpie 06-21-2003 06:52 AM

oh crap, i strike again... yeah, you only compiled the program, you didn't actually RUN it. right now you'll have a new program called a.out which is the compiled code.


All times are GMT -5. The time now is 02:34 PM.