Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7985435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:33:17+00:00 2026-06-04T11:33:17+00:00

I write a C code that have power function that is from math.h library.

  • 0

I write a C code that have power function that is from math.h library. when I compiled my program, I received an error which is ” undefined reference to ‘pow’ function “, I compile my program using gcc compiler (fedora 9).

I insert -lm flag to gcc then, the error is omitted but the output of the pow function is 0.

#include<math.h>
main()
{
double a = 4, b = 2;
b = pow(b,a);
}

Can anyone help me? Is there is a problem in my compiler??

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:33:18+00:00Added an answer on June 4, 2026 at 11:33 am

    Your program doesn’t output anything.

    The 0 you are referring to is probably the exit code, which will be 0 if you don’t explicitly return from main.

    Try changing it to a standards-compliant signature and return b:

    int main(void) {
      ...
      return b;
    }
    

    Note that the return values is essentially limited to 8 bits-worth of information, so very, very limited.

    Use printf to display the value.

    #include <stdio.h>
    ...
      printf("%f\n", b);
    ...
    

    You must use a floating point conversion specifier (f, g or e) to print double values. You cannot use d or others and expect consistent output. (This would in fact be undefined behavior.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to write a function that would have some optional code to be
Sometimes I have to write code that alternates between doing things and checking for
So far I have managed to write some code that should print the source
I'm trying to write code that will load an image from a resource, and
I am trying to write some code that that will draw the line which
My problem is that I have to write code to check if a customers
My problem is that I have to write code to check if a customers
I have a snippet of code that writes the data alphabetically from a database
I want to write a function that returns the nearest next power of 2
I have the following task: Write a program that asks for a number and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.