How to use power function under linux environment.eg :
for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined
reference to 'pow'.

Answers were Sorted based on User's Feedback



How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it ..

Answer / anuj

compile the code by writing this command
gcc filename.c -lm

Is This Answer Correct ?    2 Yes 2 No

How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it ..

Answer / seema

thank you !!!!!!!!!!!!IT work...!:) :D

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }

29 Answers   IBM, TCS, UGC NET, Wipro,


plz send me all data structure related programs

2 Answers  


main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }

1 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,






why java is platform independent?

13 Answers   Wipro,


how can i cast a char type array to an int type array

2 Answers  


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

0 Answers  


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


main() { int i=10; void pascal f(int,int,int); f(i++,i++,i++); printf(" %d",i); } void pascal f(integer :i,integer:j,integer :k) { write(i,j,k); }

1 Answers  


What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }

1 Answers  


Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


Categories