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
Naya [18.7K]
3 years ago
10

Write a program that will read in id numbers and place them in an array.The array is dynamically allocated large enough to hold

the number of id numbers given by the user. The program will then input an id and call a function to search for that id in the array. It will print whether the id is in the array or not.
Computers and Technology
1 answer:
AveGali [126]3 years ago
3 0

Answer:

#include <stdio.h>

#include <stdlib.h>

int main() {

  int n, i, *p, s;

  scanf("%d", n);

  p = (int*) malloc(n * sizeof(int));

  if(p == NULL) {

     printf("\nError! memory not allocated.");

     exit(0);

  }

  printf("\nEnter elements of array : ");

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

     scanf("%d", p + i);  

  }

  scanf("Enter Id to be searched: %d", s);

  for(j = 0; j < n; ++j) {

     if (s == *(p+j)){

         printf("ID number is in the array at position %d", j);

     }else{

         printf("Error: ID number does not exist.");

     }  

  }

  return 0;

Explanation:

The C program source code inputs integer values to dynamic array size, and the search variable is looked for in the array using a for loop. If the search term exists, then the index position is printed on the screen, else an error message is displayed on the screen.

You might be interested in
How do you create multiple columns in Word?
mrs_skeptik [129]

Answer:

I think it's B

Explanation:

it sounded right to me.

7 0
3 years ago
Differences between windows xp and windows vista
krek1111 [17]
Well since Windows XP runs on Windows 2000 technology,it would be "slow".Also that Windows XP had MSN,which expired 15 years ago,but the good thing about Windows XP is that it can connect to the internet via WiFi without the computers hardware used for WiFi(PC only).Also that Windows XP has a logo on the start-up screen.Windows Vista on the other hand, doesn't have a logo on the start-up screen,but shows a Windows Vista animated logo atfer the start-up screen.Also that some people named Windows Vista "The first Windows 7".But somewhat,Windows Vista ran faster than Windows XP at starting up.Windows Vista was old,but it sold better than Windows XP.
6 0
3 years ago
Help me plz What character must always be used when a formula is enter in a cell? (on a spreadsheet)​
lara [203]

Answer:

The equal sign "=" must be used.

Most, if not all, spreadsheet programs support formulas, but you must start them with an equal sign.

8 0
3 years ago
Which two protocols manage neighbor discovery processes on ipv4 networks?.
serious [3.7K]

Answer:

Which two protocols manage neighbor discovery processes on IPv4 networks? TCP and UDP BGP and OSPF ICMP and ARP IPv4 and IPv6

Key Links. Pricing.

Subjects. Medical & Nursing.

Company. About Us.

Find Us.

Explanation:

6 0
2 years ago
Software created according to user choice​ true or false
solniwko [45]

Answer:

True

Explanation: so that everything we want is available that is why we can customize our interface.

3 0
3 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • Web definition what means web
    9·1 answer
  • To create a cover letter to send to potential employers along with a resume, what software program should you use ?
    6·2 answers
  • To rename a database object, press and hold or right-click the object in the navigation pane and then tap or click ____ on the s
    10·1 answer
  • 1. The global economy involves trading between people from different _____
    8·1 answer
  • ______involves encoding information using fewer bits than the original representation Group of answer choices
    6·1 answer
  • RAM memory is intended?
    8·1 answer
  • What are village by laws​
    12·1 answer
  • drag each type of document to the correct location on the table. Drag each document to its respective category
    7·1 answer
  • How is data written to a blockchain?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!