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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:22:44+00:00 2026-06-03T15:22:44+00:00

I have a simple C-program ./my_program #include <stdio.h> int main (int argc , char

  • 0

I have a simple C-program "./my_program"

#include <stdio.h>

int main (int argc , char **argv) {


   unsigned int return_result = 0x474;
   printf("return_result = %d = 0x%x \n",return_result,return_result);
   return return_result;

}

As a result, this program prints:

return_result = 1140 = 0x474 

I want to get a return value of c-program within bash script.
According to this link
Anyway to get return value of c program from command line?
I should get this variable from $?

But when I launch such commands consequence:

./my_program
echo $?

I get

116

It is obviously, that 116 = 0x74 (the lowest byte).
But I’d like to get the whole unsigned int value.
What is wrong? What should I do to get the whole return value of c-program from command line? This is not about only “unsigned int” type. What should I do in case if I created some complicated type, for example, – structure.

I tried this:

return ((unsigned int) return_result_section_size);

It doesn’t work.

  • 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-03T15:22:46+00:00Added an answer on June 3, 2026 at 3:22 pm

    Exit codes on Unix are restricted to a single byte. If you want to output more, you could write it to stdout or to a file instead.

    Then why does the C standard decree that main returns int and not char? I have no idea…

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

Sidebar

Related Questions

Here is my program: #include <stdio.h> int main(int argc, char **argv) { printf(hello world\n);
I have a very simple C++ application. #include <stdio.h> #include <iostream> int main(int argc,
I have witten a simple c program as follows: #include <stdio.h> #include <regex.h> int
#include <unistd.h> #include <stdio.h> #include <string.h> #include <sys/sendfile.h> #include <sys/stat.h> #include <fcntl.h> int main(){
In my google maps program I have simple KML parser which retrieve only coordinates
I have the following simple equation in my C# program to convert a number
I have made my own file type (.ddd) and I made a simple program
Say I have simple program that emulates a board game with a number of
I have Simple java program named MainController.java. Wehn I try to compile it from
I have a simple program that creates a thread, loops twenty times and then

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.