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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:18:33+00:00 2026-06-11T14:18:33+00:00

I’m sorry if this is confusing….So far I’m converting a decimal number into binary.

  • 0

I’m sorry if this is confusing….So far I’m converting a decimal number into binary. While doing this, i store the digits for the binary representation into an int array.

EX: for the number 4. (this is done in dec2bin below)

    temp[0] = 1
    temp[1] = 0
    temp[2] = 0

i would like to store this array into another array (say BinaryArray) that will contain multiple ‘temp’ arrays.

I would like the BinaryArray to declared main, passed to dec2bin, and the save a copy of the current temp array. then go to the next number.

I’m having trouble with figuring out the pointers and what not needed for this. If someone could help me with how to declare the needed array in main and how add to it from dec2bin.

Thanks!
Main:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main()
    {      

      void dec2bin(int term, int size);

      int size, mincount;
      int * ptr;
      int x;
      x=0;

      scanf("%d %d", &size, &mincount);
      printf("Variables: %d\n", size);
      printf("Count of minterms: %d\n", mincount);

      int input[mincount+1];

      while(x < mincount){
        scanf("%d", &input[x]);
        x++;
      }
      x = 0;

      while(x < mincount){
        dec2bin(input[x], size);

Dec2bin :

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #define SIZE 32

    void
    dec2bin(int term,int size){
      int i, j, temp[size], remain, quotient;
      quotient = term;
      i = size-1;
      // set all temp to 0
      for(j=size-1;j>=0; j--){
        temp[j] = 0;
        }

      //change to binary
      while(quotient != 0){
        remain = quotient % 2;
        quotient/=2;
        if(remain != 0){
          temp[i] = 1;
         } else {
          temp[i] = 0;
         }
         i--;
        }

        //print array
        for(i=0; i<size; i++)
          printf("%d", temp[i]);

        printf("\n");
    }
  • 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-11T14:18:34+00:00Added an answer on June 11, 2026 at 2:18 pm

    Don’t have sure if i understood what you want to do, but it seems that you want to create a “array of arrays of int”.
    Example:

    #include <stdio.h>
    #include <stdlib.h>
    
    int main(){
        int i;
        int n;
        int **myArray;
    
        n = 10;
        myArray = (int**)malloc(n*sizeof(int*));
    
        //Usage example
        int myIntArray[] = {1,2,3,4,5};
    
        myArray[0] = myIntArray;
    
        //This call should print "4"
        printf("%d\n",myArray[0][3]);
    
        return;
    }   
    

    This way you will have a array (myArray) that each element is a array of ints.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.