1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
frozen [14]
3 years ago
9

Add the following functions to the code:

Computers and Technology
1 answer:
artcher [175]3 years ago
7 0

Answer:

See explaination

Explanation:

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

void oddsOnly(char* str)

{

int i;

for (i = 0;i < strlen(str);i++)

{

if(i%2 != 0)

{

str[i/2] = str[i];

}

}

str[i/2] = '\0';

}

char* mySubstring(char* string ,int beginIndex,int endIndex)

{

char* new_string = malloc(endIndex- beginIndex);

for (int i = beginIndex ;i < endIndex;i++)

{

new_string[i -beginIndex] = string[i];

}

new_string[endIndex] = '\0';

return new_string;

}

int main(void)

{

char str[] = "hello there";

oddsOnly(str);

char* str1 = mySubstring("smiles",1,5);

printf("%s\n",str);

printf("%s\n",str1);

}

You might be interested in
Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, i
adell [148]

Answer:

import java.util.Scanner;

public class ss11{

       public static void main (String[]args) {

             Scanner keyboard = new Scanner (System.in)

             String a1, a2, a3, a4, a5;

              int i1, i2, i3, i4, i5;

              System.out.println("Enter a four bit binary number:");

               a1= keyboard.next();

               a2= a1.substring(0,1);

               a3= a1.substring(1,2);

               a4= a1.substring(2,3);

               a5= a1.substring(3,4);

                i1 = Integer.parseInt(a2);

                i2 = Integer.parseInt(a3);

                i3 = Integer.parseInt(a4);

                i4 = Integer.parseInt(a5);

                i1= i1 * 8;

                i2= i1 * 4;

                i3= i1 * 2;

                i4= i1 * 1;

                i5= i1+i2+i3+i4;

                System.out.println("The converted decimal number is: +i5);

}

}

Explanation:

7 0
3 years ago
Use the Wrap Text icon to _____. modify which graphic appears in the front of layered images modify the picture effects change t
sergey [27]

I believe it's change the way text is wrapped around an object.

3 0
3 years ago
Read 2 more answers
When considering changing the content of a cell which button should you press to leave the cell as it originally was?
densk [106]
Esc key or cancel .........
7 0
3 years ago
Read 2 more answers
How do you find binary?
trasher [3.6K]

Answer:

To convert integer to binary, start with the integer in question and divide it by 2 keeping notice of the quotient and the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. Then just write out the remainders in the reverse order.

Explanation:

3 0
2 years ago
What are examples of intermediate goals that require funding? Check all that apply.
SashulF [63]
2.) Attending college
3 0
3 years ago
Read 2 more answers
Other questions:
  • All of the following are stages in the SDLC except _____.
    9·1 answer
  • Which table option automatically adjusts column widths to fit cell content? autofit contents merge cells autofit window fixed co
    5·1 answer
  • Write another function to convert a value to its word equivalent leveraging the following tuple - o Number = (‘One’, ‘Two’, … ‘N
    10·1 answer
  • Using the notation exemplified in following question , list a set of tables and attributes (and identify keys) to represent the
    10·1 answer
  • How to buy free big money computers that earn free money everydays?
    15·1 answer
  • sandra has houseplants sitting on her kitchen windowsill, where it receives a lot of sunlight . what will most likely be the pla
    9·2 answers
  • Before her shift as a cashier at the grocery store, Carla pulls her hair back into a ponytail and makes sure her fingernails are
    11·1 answer
  • Implemente a função ao lado, que recebe um preço e um booleano indicando se já está com desconto ou não. Se o preço for maior qu
    8·1 answer
  • Which subunit of a heterodimeric cdk is the regulatory subunit?
    6·1 answer
  • Gary says, "Ports are where data enter a network before reaching a gateway. The data travel via transmission
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!