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
I need help for my computer science class I would appreciate it
kirill115 [55]

Answer:

21

Explanation:

a = 7

b = 7

c = 2

7 is greater than or equal to 7 , so it will return 7 + 7 *2 which is 21

5 0
2 years ago
______ are single numbers or values, which may include integers, floating-point decimals, or strings of characters.
marysya [2.9K]

Scalar Values are single numbers or values, which may include integers, floating-point decimals, or strings of characters.

A(n) array is a group of scalar or individual values that are stored in one entity.

A(n) user-defined type is a data type that is assigned a true or false value by a programmer.

A(n) abstract data type is a data type that can be assigned multiple values.

4 0
3 years ago
Monica is teaching herself to paint. What web resource would be the most helpful
strojnjashka [21]

Answer:

Video Tutorial

Explanation:

The others don’t make sense.

3 0
3 years ago
Why might you use the More button in the Find and Replace dialog box?
den301095 [7]

Answer:

Use the More button to display more options to help narrow the search criteria.

Explanation:

<em> I think hope this helps you!!</em>

6 0
2 years ago
List three differences between word and excel
34kurt

Answer:

Word: A word processor

           File extension is .doc

          Images, texts, and graphic styles can be added

Exel: A spreadsheet software

       Comprises rows and columns which combine to form cells

       File extension is .xls

I hope i helped! xoxo

4 0
2 years ago
Other questions:
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    11·2 answers
  • Musccanic Inc., a company that manufactures microprocessors, updates the technology used in its microprocessors once every four
    15·1 answer
  • In Alphatech Systems, email software screens incoming messages by organizing them into mailboxes and identifying junk mail. As a
    13·1 answer
  • Lazarus Consulting is a large computer consulting company in New York. Pete Lazarus, theà CEOà and founder, is well known for hi
    8·1 answer
  • The _____ of a local variable is the function in which the variable is created.
    6·1 answer
  • Please help explain this calculator code.
    15·1 answer
  • Huh? translate this please. (jk, I know what it says I just want to test everyone.)
    13·1 answer
  • Which phrase best describes a scenario in Excel 2016?
    5·2 answers
  • Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time
    13·1 answer
  • What is the difference between PowerPoint and Outlook?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!