Question: HERES MY CODE I KEEP GETTING ERRORS CAN YOU HELP ME FIX IT SO THAT IT OUTPUTS CORRECT.THANKS! #include void palindrome( int num) { char

HERES MY CODE I KEEP GETTING ERRORS CAN YOU HELP ME FIX IT SO THAT IT OUTPUTS CORRECT.THANKS!

#include void palindrome( int num) { char binary[32]={0}; //to store binary equivalent of the number n int i = 0; for(i=0;num>0;i++) //traverse unless number does not become 0 { binary[i]=num&1; //each time get the extract the lsb num=num>>1; //and shift the number rightwards one bit } printf("Enter a number in a range of 2 billion: "); scanf("%d",&num); // If user inputs negative integer if(num<0) { printf("Entered number must be positive: "); printf("Number in Binary : "); //print the number in binary for(i=31;i>=0;i--) printf("%d",binary[i]); }

//reversing bits to check palindrome from both sides int rev_bits (int num_num )

{ int reverse = 0; while (num_num > 0) { reverse= reverse<< 1; if (num_num & 1 == 1) reverse ^= 1; num_num = num_num >> 1 ; }

return reverse; }

//checking if binary rep is palindrome or not _Bool checkPalindromeNumber (int num_num) { int after_rev = rev_bits(num_num);

return (num_num == after_rev); } }

BUT I KEEP GETTING THIS ERROR

(.text+0x20): undefined reference to `main' 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!