Question:
how to Compile the below program ?
vs.sv27
2010-10-21 03:09:19 UTC
include
main( )
{
int a,b,c;
clrscr( );
printf("enter the a,b values");
scanf("%d%d",&a,&b);
c=pow(a,b);
printf("the result is=%d",c);
getch( );
}
how to Compile this program in Linux Terminal ?i already did so many programs in linux ,but this one goes wrong.
Four answers:
2010-10-21 03:11:27 UTC
i m nt sure about main() but



getch(); cant come in Linux Prog.
jplatt39
2010-10-21 10:35:50 UTC
This one goes wrong because of clrscr() and getch(). As used, they are part of the conio.h library which is windows specific. On Linux and Unix you want to use ncurses:



http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/



Meanwhile just take them out.
balakrishnan
2010-10-24 09:04:11 UTC
in linux always use int main() and return 0;

dont use getch() and clrscr()



compile as cc filename.c or gcc filename.c

and execute ./a.out
Nihar
2010-10-21 10:11:26 UTC
http://www.google.co.in/url?sa=t&source=web&cd=1&ved=0CA4QFjAA&url=http%3A%2F%2Fwww.linuxhelp.net%2F&ei=nRHATPOxB4SuvgOy6rHvCA&usg=AFQjCNFGWi7la0X1COqz3RRDshXDQHdvyg


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...