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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:01:00+00:00 2026-06-14T13:01:00+00:00

i want to print this array of countries but when are two countries same

  • 0

i want to print this array of countries but when are two countries same i want to print it just once. countries are already ordered alphabeticaly any ides ???

for(b=0;b<v;b++){

if(strcmp(country[b-1],country[b]) !=0){
    printf("%s",country[b]);}

}

v is number of countries

  • 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-14T13:01:01+00:00Added an answer on June 14, 2026 at 1:01 pm

    Allocate a 2 dimensional character array dynamically for krajina.

    Refer this question:
    2 Dimensional Memory Allocation

    EDIT: Elaboration:

    Alright. You said you can count the number of countries. Say you store that in a variable called count ok?

    Now you need to allocate a 2D character array with count number of rows and 31 columns right? You do this as follows.

    int i = 0;
    int **country = NULL;
    
    if (!(country = calloc(count, sizeof(*country)))) //allocate rows
        return (0);
    for (i = 0; i < count; i++)
    {
        country[i] = calloc(31, sizeof(*(country[i]))); //allocate columns
    }
    

    Now you have the country variable which you can use normally like how you would use a 2d char array (like youve used in your code)

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

Sidebar

Related Questions

I want to print something like this (a 7-day calendar) but with the ability
I want to print all the prime numbers between two numbers. This is my
This code is not pretty, but I want to print out the last generated
This should be a trivial question. But I am confused. I want to print
i have this multi dimentional array that i want to print into a table
I want to print array variable $foo . So I have done {$foo|@print_r} this
Please check the following code. I want to print array, but it only print
I want to build a 2 dimensional (non ragged at this point) object array.
I have this webservice snippet and i want to print the actual value returned.
I want to print the ID of the comment (eg. 10151828637085391_33268745 ) from this

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.