mirror of
https://github.com/RolandWH/ceesort.git
synced 2025-03-14 17:01:36 +00:00
fixed formatting errors
This commit is contained in:
parent
2c9ce86b76
commit
f7ffa91c11
@ -114,11 +114,20 @@ int main(int argc, char** argv)
|
||||
{
|
||||
char target_str[16];
|
||||
printf("Enter number to search for: ");
|
||||
fgets(target_str, 16, stdin); target_str[strcspn(target_str, "\n")] = 0;
|
||||
fgets(target_str, 16, stdin);
|
||||
target_str[strcspn(target_str, "\n")] = 0;
|
||||
while (!isint(target_str))
|
||||
{ printf("Sorry but you must enter a whole number, try again: "); fgets(target_str, 16, stdin);
|
||||
{
|
||||
printf("Sorry but you must enter a whole number, try again: ");
|
||||
fgets(target_str, 16, stdin);
|
||||
}
|
||||
int target = atoi(target_str); int result = lsrch(arr, n, target); if (result == -1) puts("Value not found"); else printf("Value found at index: %d\n", result);
|
||||
int target = atoi(target_str);
|
||||
|
||||
int result = lsrch(arr, n, target);
|
||||
if (result == -1)
|
||||
puts("Value not found");
|
||||
else
|
||||
printf("Value found at index: %d\n", result);
|
||||
}
|
||||
|
||||
free(arr);
|
||||
|
@ -14,4 +14,3 @@ int lsrch(int* arr, int n, int target)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -9,4 +9,3 @@
|
||||
|
||||
|
||||
int lsrch(int* arr, int n, int target);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user