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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:05:45+00:00 2026-05-26T22:05:45+00:00

input is like this 5 // is # of vertices 1 1 0 1

  • 0

input is like this

5 // is # of vertices
1 1 0 1 // 1<->2 1<->3 1<->4 1<->5
0 0 0 // 2<->3 2<->4 2<->5
0 1 // 3<->4 3<->5
1 // 4<->5

I want to make adjacency matrix, when that input is inserted. how to do that?

I made already matrix like this

array = (int)malloc(sizeof(int)*numVetex);
  • 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-05-26T22:05:46+00:00Added an answer on May 26, 2026 at 10:05 pm

    There are many ways to do this. Here is one of them:

        int **array;
        int numVertex;
        int i,j;
    
        scanf("%d",&numVertex);
        array = malloc(sizeof(int*) * numVertex);
        for(i=0;i<numVertex;i++) {
                array[i] = malloc(sizeof(int) * numVertex);
        }
        for(i=0;i<numVertex-1;i++) {
                for(j=i+1;j<numVertex;j++) {
                        scanf("%d",&array[i][j]);
                        array[j][i] = array[i][j];
                }
                array[i][i] = 0;
        }
        // use array 
        // free it
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input like this RX Only : Gi1/0/15,Gi1/0/20,Gi1/0/17 I want to capture
I want to send the post data from an input like this: <input type=file
I have a Login page that captures User input like this. MD5calc ss =
We can initialize a container deque by using standard input like this: deque<int> c((istream_iterator<int>(cin)),(istream_iterator<int>()));
I want to give integer input to Ruby like this: 12 343 12312 12312
I have an input like this test1.test2.part01 which I want to strip away to
i have to make a program which can accept input like this: 2012-01-20 10:50:52
i have an array input like this Array ( [col1] => Array ( [208]
I want user to be able to input like this: 5+6*t+sin(2*t) , so it
Quesition: Given input like this: int myintsA[]={1,3,3,2,2,5,5,5,4}; int myintsB[]={0,9,8,6,7,3,3,4}; Find same elements, out put

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.