Steps to Follow Executing Linear Search into Array in C Programming
Creating a program is the first step which is made with a program such as code blocks. It involves the creation of an application under the C category. After the creation of the program, the C program files will have a .c extension to set it apart from the rest.
The next step is preprocessing and compiling. After the program is created, it is assembled with the use of a compiler. The compiler translates it into a machine-readable language. Before the final compilation, the preprocessor executes by to adhere to the commands from its directives keenly.
The linker after that links the codes of the programs to functions which were missing. It additionally connects the system of the object with the libraries.
The fourth stage of developing the program is loading whereby the loader puts the completed application (compiled) into the computer. The program is stored in the memory.
Finally, the computer functions by executing the loaded program. Additionally, a user can use a linear search to search the C programming by array, it identifies the position of a specific number in a set of numbers arranged in array form. If the number is found in the collection, it is located.
/* Linear Search into array search the value in serial way*/
/* here a - storage of array value
f,l,m - first, last, mid position of array
x - search value
i - index variable
flag - determine the value found or not found
printf("enter how many value in array\n");
printf("Enter %d value \n",n);
printf("Which value to be search ->");
/* Linear Search logic */
printf("%d value not found\n",x);
printf("%d value found at location %d\n",x,i);