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 123749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:20:09+00:00 2026-05-11T04:20:09+00:00

Okay here’s the program I have typed up(stdio.h is included also): /* function main

  • 0

Okay here’s the program I have typed up(stdio.h is included also):

/* function main begins program execution */ int main (int argc, char *argv[]) {     int x; /*first number input*/     int y; /*second number input*/     int sum; /* variable in which sum will be stored */     int product; /* variable in which product will be stored */     int quotient; /* variable in which x divided by y will be stored */     int md; /* variable in which the modulo division of x divided by y */      x = argv[2]; /*assign total to x*/     y = argv[3]; /*assign total to y*/      if (argc ==3) {        sum = x + y; /* assign total to sum */        printf('%d\n',sum); /*print sum*/         product = x * y; /*assign total to product*/        printf('%d\n', product); /*print product*/         quotient = x / y; /*assign total to quotient*/        printf('%d\n', quotient); /*print quotient*/         md = x % y; /*assign total to md*/        printf('%d\n', md); /*print md*/     } /*end if*/      if (argc !=3) {        printf('need two integers\n'); /*need two integers*/     }      return 0; /*indicate program ran successfully*/ } /*end of main*/ 

When I run it through the compiler it says that in lines 15 and 16 (x= and y= lines) ‘assignment makes integer from pointer without a cast.’ How do I fix this?

**I changed it to x=atoi(argv[2]) and y=atoi(argv[3]) and it fixed that problem. But as always something else has now screwed up. Now when I run the program I get:

163 [main] a_4312 _cygtls::handle_exceptions: Error while dumping state

Segmentation fault

I read that this means I didn’t allocate memory for the output or something like that…can anyone give me a hand here?**

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T04:20:09+00:00Added an answer on May 11, 2026 at 4:20 am

    The compiler error was due to you assigning text to a number. You actually need to call a function to convert between the 2 atoi.

    The most important runtime error is the seg fault, this is caused by using the wrong indexes into the array, c has 0 based arrays so the first element is 0, this means the 2 arguments you want are 1 and 2 (since the first argument is the executable’s name).

    Finally, you may want to check the y value before the divide and mod since if it’s 0 you’ll get divide by zero problems.

    x = atoi(argv[1]); /*assign total to x*/ y = atoi(argv[2]); /*assign total to y*/ 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

Okay here's the program I have typed up(stdio.h is included also): /* function main
Hey all. Okay here is the situation. I would like to be able to
Okay so I have a scenario similar to the below code, I have a
For clarification purposes I need the program to print the numbers that are input
I know it's not sporting asking for this kind of help, But I've been

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.