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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:12:06+00:00 2026-06-13T09:12:06+00:00

I an new in c programing so I am not understanding to work for

  • 0

I an new in c programing so I am not understanding to work for the process.

I have a structure defined like following way.

struct codons
{
    char amino_acid[20], slc[20], dna_codon[40];
};

struct codons c1 = {"Isoleucine", "I", "ATT, ATC, ATA"};
struct codons c2 = {"Leucine", "L", "CTT, CTC, CTA, CTG, TTA, TTG"};

User has to input the string sequence. for example :

printf("Enter the sentence: ");
gets(str);

if user enters string like :

ATTCTGCTTTTA

Then I have to convert this string to 3char length strings like

ATT, CTG, CTT, etc.   

and then, I have to check if that this short string of 3 chars present in structure of not.

I dont have any idea how I can convert the string into 3char string length and check.
Can anyone suggest me something?

  • 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-13T09:12:07+00:00Added an answer on June 13, 2026 at 9:12 am

    You could do something like below:

    char* input_string = ...;
    
    //check if user entered string that could be divided into 3 letters substrings
    if (strlen(input_string) % 3 != 0)
      return;
    
    while (*input_string != '\0')
    {
       char string_3l[4] = {'\0'};
       strncpy(string_3l, input_string, 3);
    
       //check if string_3l is part of structure 
       if ((strstr(string_3l, c1.dna_codon) != NULL) || 
                   (strstr(string_3l, c2.dna_codon) != NULL))
       {
            //YOU HAVE MATCH!
       }
    
       input_string += 3;
    }
    

    Of course you should check in both c1 and c2 structures.

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

Sidebar

Related Questions

I'm doing my first web app (not new to programing) and I have a
I'm new to Django and Web programming in general. Have googled but could not
I am new to programing and I have some difficulties getting AlertDialog working. I
I'm new to programming and some OOP concepts and am not sure what is
I'm new to Java but not to programming. I'm reading the book Beginning Android
It tells me line 1 and line 5 (new to debugging/programming, not sure if
First, i'm new at Java-programming and my native lang is not english, but still
I'm not sure whether these are programming questions, but I'm sure lots of new
I'm new to Xcode and programming for iOS, so I might not get what
I am Completely new to Objective C and Cocoa programming. Why does NSApplicationMain not

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.