Question: Help C language question: major1.c: #include major1.h int main() { unsigned int integer; printf(Type an integer less than 10: ); scanf(%d, &integer); reverse_bit(integer); } ---------------------------------------------------------------------------

Help

C language question:

Help C language question: major1.c: #include "major1.h" int main() { unsigned int

major1.c:

#include "major1.h" int main() { unsigned int integer;

printf("Type an integer less than 10: "); scanf("%d", &integer);

reverse_bit(integer); }

---------------------------------------------------------------------------

major1.h

#include

unsigned int reverse_bit(unsigned int number);

------------------------------------------------------------------------

program1.c

#include "major1.h" #include #include

unsigned int reverse_bit(unsigned int number) { int total_bits = sizeof(number) * 8; int reverse_number = 0; int i; for (i = 0; i

int main(){ unsigned int num; printf("Enter a positive integer less than 2 billion: "); scanf("%u", &num); if ( num

integer; printf("Type an integer less than 10: "); scanf("%d", &integer); reverse_bit(integer); }

The reason I'm are getting this error is because I have created multiple files which have the main function, and only one file should have the main function, which is major1.c.

However, I had to include the main function to the program1.c file, so I could test it. There's no problems in the major1.c or major1.h, they don't need to be changed, just program1.c. I have to get rid of the main function, but not sure how too. I think program1.c should just be one single function without the main function.

I need assistance to fix this error please!

. majorl.h This file is the overall header file for the project and will contain any preprocessor directives, such as include and define directives, and function prototypes. majori.c This is the code file with the main () function that will do the following: (1) display the menu, (2) read in the user's response for the menu selection, (3) prompt for and read in a positive integer less than two billion, and then, based on the menu selection, (4) call the appropriate function call for the specified operation, passing the integer operand as a parameter to that function. major1.c major 1.h program1.c 1 #include "majori.h" 2 int main() 3. { 4 unsigned int integer; 6 printf("Type an integer less than 10: "); 8 scanf("%d", &integer); 9 10 reverse_bit(integer); 11 } 12 13 14 input Compilation failed due to following error(s). /tmp/CCSCR74Y.o: In function 'main': program1.c:(. text+0x5b) : multiple definition of 'main' /tmp/CC67Bndz.o:majori.c:(.text+0x0): first defined here collect2: error: ld returned 1 exit status

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!