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]
4 years ago
9

Add the following functions to the code:

Computers and Technology
1 answer:
artcher [175]4 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
The computer component that makes sure that instructions are decoded and executed properly is the ___________.
Shalnov [3]

Answer:

The Central Processing Unit

Explanation:

The Central Processing Unit is the brains of the computer where most calculations take place. A central processing unit (CPU), also called a central processor or main processor is the electronic circuitry within a computer that executes instructions that make up a computer program. The CPU performs basic arithmetic, logic, controlling, and input/output (I/O) operations specified by the instructions.

8 0
3 years ago
Read 2 more answers
Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correc
NNADVOKAT [17]

Answer:

There are two ways in which programs ... count-controlled loops; condition-controlled loops ... Sometimes it is necessary for steps to iterate a specific number of times. ... A count-controlled loop is used when the number of iterations to occur is ... the variable 'count' is used to keep track of how many times the algorithm

Explanation:

5 0
3 years ago
Read 2 more answers
The Company should use BLANK cables to provide Fast connectivity without electrical interference
Lisa [10]

they should use Ethernet! it offers fast and easy setup, and is just plug and play!

3 0
3 years ago
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
Andrew [12]

Answer:

function pecoDesconto(preco, estaComDesconto) {

 

 let p = preco;

 let desconto = estaComDesconto;

 if(p > 100 && desconto == false){

   return "Quero pechinchar";

 }else{

   return "Negócio fechado";

 }

}

Explanation:

function pecoDesconto(preco, estaComDesconto) {

 

 // Implemente a função ao lado, que recebe um preço//

 let p = preco;

// variavel que indica desconco//

 let desconto = estaComDesconto;

//Se o preço for maior que 100 e não estiver com desconto, a função deve retornar Quero pechinchar.//

 if(p > 100 && desconto == false){

   return "Quero pechinchar";

   //Caso contrário, deve retornar Negócio fechado

 }else{

   return "Negócio fechado"

 }

}

só te faltou ler com atenção, e um pouco de logica!

7 0
2 years ago
Create a static method called fillArray, which takes an integer array as an input parameter, along with an integer initial value
JulijaS [17]

Answer:

public class print{

   

   public static void fillArray(int[] arr, int initialValue){

       

       int n = arr.length;

      for(int i=0;i<n;i++){

          arr[i] = initialValue++;

      }

       for(int i=0;i<n;i++){

           System.out.print(arr[i]+" ");

      }

       

   }

    public static void main(String []args){

       

        int[] array = new int[5];

        int initialValue =3;

       

        fillArray(array,initialValue);

       

    }

}

Explanation:

Create the function with two parameter first is array and second is integer.

Then, declare the variable and store the size of array.

Take the for and fill the array from the incremented value of initialValue  by 1 at every run of loop.

After loop, print the element of the array.

Create the main function which is used for calling the function and also declare the array with size 5 and initialValue with 3. After that, call the function with this argument.

3 0
4 years ago
Other questions:
  • A local area network works as a ____ network in that clusters of workstations are connected to a central point (hub or switch) t
    6·1 answer
  • Which computer network component allows data transfers from one computer to another through a telephone line?
    11·2 answers
  • How do you change exposure to allow for greater DoF
    10·1 answer
  • Andre is teaching a class without the software development cycle while teaching the analyst phase which task should Andre mentio
    8·1 answer
  • Design a hierarchy c hart or flowchart for a program that calculates the current balance in a savin gs account. The program must
    8·1 answer
  • Digital certificates can be used for each of these EXCEPT _____. A. to encrypt channels to provide secure communication between
    13·1 answer
  • Device driver:<br> System software or application software
    11·2 answers
  • In news writing, which is bigger , a topic or a angle
    10·1 answer
  • Why do you think that network and telecommunications security careers are some of the fastest growing in the field of technology
    8·1 answer
  • Jamal wants to create a program that will play music during the afternoon. Which kind of loop should be used in the program?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!