# find « find « C Array Q&A

Home
C Array Q&A
 1 bit 2 Byte 3 char 4 class 5 Development 6 Dimensional Array 7 dynamic 8 element 9 find 10 index 11 initialization 12 Integer 13 length 14 loop 15 memory 16 Operation 17 pointer 18 Print 19 size 20 Sort Search 21 string 22 struct 23 variable
 C Array Q&A » find » find

### 1. Write a program to find out the combination of an element of each array gives a result 0    stackoverflow.com

Input:

``````array 1: {2,1,4,7}
array 1: {3,-3,-8,0}
array 1: {-1,-4,-7,6}
``````
Output:
``````pairs =
{2,-8,6}
{1,3,-4}
{4,-3,-1}
{7,0,-7}
``````
Code:
``````#include<stdio.h>
#include<conio.h>
#include<String.h>

int main() {
int clrscr();
int a[3] = { 2, 5, 7 }, b[3] = { -3, -2, -5 }, i, j;
...``````

### 3. Finding Posistion of array elements    bytes.com

I want to write a program which take input and save the poistions of the array elements in another array. let if i enter an array A[0]= 4 A[1]=1 A[2]=2 A[3]=3 now the output array will hold 1 2 3 0 i-e the posistions of the array elements starting from the smallest number. As 1 is the smallest number and it ...

### 4. Find all the roots form one point to another in an array    bytes.com

Hi, I have a problem that I cant finger it out. My program have to read an array and then dynamically store it to the memory. Ok 'till now. The thing is that the program has to calculate all the possible root in this array from one array[a][b] to another array[c][d]. The array is a NxN and you can see it ...

### 5. SegFault in little arrays, I can't find the bad call...    bytes.com

After reading through more of the SegFault posts, I see a common theme, check your arrays....I've done that, to head you off at the pass. If I set the arrays to values Greater than the number of elements I'd ever need, should that cover those situations? I also initialize both arrays with values, 0 for the intArrray, and either the name ...

### 6. finding uncommon elements from 2 array    bytes.com

Are you able to write down on a piece of paper the steps you would follow to do this with two arrays that are also written on paper? Often, you can code from a description. It's kind of a poor man's desiogn specification. Rarely, however, can you code straight out of your head.

### 7. Finding blocks of symbols on a 2dimensional array    bytes.com

Hi to all, I am creating a program which plays a game. The game is played on a NxN square board. In every position of the board we may have a ball or not. Take for example the following 5x5 board ( x : ball, o : empty space). x x o o x x o o o o o o ...

### 8. Exercise reverse array . I can't to find error .    cboard.cprogramming.com

#include#include void main() { int A[100]; int B[100]; int i,n; // Input total values printf("How many values do you want to input : "); scanf("%d",&n); // Input each of value for(i=0;i0;i--) { A[i] = B[i]; } // Display for(i =0;i

### 9. Find the fixed point of an array ...i.e return i if a[i]=i..    cboard.cprogramming.com

Write a c program for the following Find the fixed point of an array ...i.e return i if a[i]=i.. OBJECTIVE: Find the "fixed point" of an array Input: an array A of *distinct* integers in ascending order. (Remember that integers can be negative!) The number of integers in A is n. Output: one position i in the list, such that A[i]=i, ...

### 10. Find corners in array of points    cboard.cprogramming.com

Hi! I have an array of points, describing a rectangular shaped polygon. And I am looking for a function to extract the four corners of that polygon. The difficulty I am facing is that the top-left corner is not necessarily the point where x & y are the closest to 0. Y can be higher on the middle if the polygon ...

### 11. Finding All Adjecent Elements in a 2D array in C Language..    cboard.cprogramming.com

Hi All. I am working on a project where at one point i am stucked. my Question is for example i have the following 2D array containg 3 different integers.. 2 2 2 2 1 1 2 2 2 1 3 3 2 3 2 3 1 3 3 1 1 1 2 3 1 1 3 1 3 3 what ...

### 12. Traversing through an array to find link between elements    cboard.cprogramming.com

The following code piece is supposed to take a string of a length between 1 and 80 chars, and divide it into blocks of 16 chars each. This seems to work fine, but I would like to be able to keep track of which block belongs to which other, so that if I want to remove a whole message, every belonging ...

### 14. How to find the middle element of a bulk array?    cboard.cprogramming.com

What an amazingly bad question. First of all, there is no middle element in an array with 100 elements. There needs to be an odd number of elements for there to be a middle element. The example divides by 2 twice. Why? Now, for the worst part, there are loads of ways to do this. Not dividing but casting to a ...

### 15. Finding a hyphen in an array.    cboard.cprogramming.com

As rags_to_riches notes, the compiler always evaluates the value on the right hand side (if possible) and assigns that value to the left. So therefore, 42 = x is invalid as x will not always equal 42 and 42 is constant and cannot change. the variable x can change as it contains the value not and is not the value itself. ...

### 16. Finding substrings with arrays...need help    cboard.cprogramming.com

Write a C program that allows the user to enter two strings s1 and s2 and checks if s2 is a subtring of s1. If this is the case, it reports the index of s1 at which an instance of s2 is present, otherwise it reports that the substring was not found. For example, cat and nate are two subtrings of ...

### 19. finding mode of an array    cboard.cprogramming.com

Well, you may be screwed by now, but the mode is simply the item in a list that occurs most frequently. For small ranges, I usually recommend a frequency table. Here's an example: Code: #include #include int get_mode(int a[], int size, int max); int main(void) { int a[10]; int i; for (i = 0; i < 10; i++) { ...

### 20. Finding elements in an array    cboard.cprogramming.com

Hi, I am having trouble figuring this out, hopefully someone can help me out. I have an array: 0|8|38|0|0|0|0|0|0|7|37|0|0|0|0|0|0| Lets say someone searches for 6 consequtive 0s starting at 8 or 38. If it cant find them in that section before 7,37, I dont want it to go any further, how would I know when to stop? Also, lets say I ...

### 21. Help with finding median with arrays.    cboard.cprogramming.com

I've got a slight problem with the final part of a program I've been working on. It uses one-dimensional arrays, sorts the results in order, processes and prints the average of the numbers in the array. The final part of the program is to find the median of the numbers in the array. /* Function prototype: */ double med_dbl_arr(double array[], int ...

### 22. Finding greatest element of an array    cboard.cprogramming.com

Hmm... randomly? That is actually kinda complicated; it involves adding the row and column to a list every time you encounter a match. Actually, if you don't mind a biased distribution, it can be done in a somewhat elegant way... Code: // This is just a C code "fragment"... // I'm assuming myArray[][] is an existing 3x3 array int row=0, col=0, ...

### 23. finding proportion of an array    forums.devshed.com

if (temp_score > (max*m_flThreshold)) { m_VApixels[vapixel_counter].x = Xcount;//Array to store RGB de-similar pixels m_VApixels[vapixel_counter++].y = Ycount;//Array to store HSV de-similar pixels RGB_value=RGB(0, 255, 0); //dark green } else // else we set it to red, brightness depends on the score { m_VApixels[vapixel_counter].x = Xcount;//Array to store RGB de-similar pixels m_VApixels[vapixel_counter++].y = Ycount;//Array to store HSV de-similar pixels RGB_value=RGB(sc, 0, 0); } ...

### 24. How to find out if array element exists in C#    forums.devshed.com

I've got a piece of code which dynamically creates a table of checkboxes. In doing so, it creates an array of checkbox objects. However, the created array elements might not be sequential (i.e. array[1],array[2],array[3], etc.). Instead, they could be something like array[1],array[5],array[20] with the other array elements in between remaining uncreated and undefined. Is there a way I can find out ...

### 25. ?? filling struct array ?? cant find anything    forums.devshed.com

I tried to find answers in this horrible book that I have, but nothing. I am trying to have user enter info when prompted. I need the info to be read into array within a struct. My code is not complete, but I will post what I have. Between the printf statements in the do{ } while loop, I tried this, ...

### 26. array find    forums.devshed.com

my coding is #include #include #include void main() { clrscr(); char val; char str1[10],str2[10],str4[10]; printf("Enter sentence\n"); scanf("%s",str1); printf("Enter world\n"); scanf("%s",str2); printf("\n"); for(int a=0;a<10;a++) { if(str1[a]==str2[a]) { str4[a]=str2[a]; printf("%c",str4[a]); } } getch(); } i need the find tha word from the character array.my coding is working only if i enter word like eg: Enter sentence thisistestdata enter word this ...

### 27. Finding No. of elements in an Array    daniweb.com

if we have a string array , we can easily use strlen() and get the array length, but what if it is an integer array ? how can i find the no of elements in an int array ? ex: if i allocate space like this int no[20]; and i store about 10 nos in the array, how do i check ...

### 29. Find array placement    daniweb.com

#include #include int main() { char string[256]; //This will hold out string char chrset[256]; //this will hold the character set int num[256]; //This will hold the result int count = 0; //This is just for loops printf("Please enter a String: "); scanf("%s", string); printf("Please enter a Character set: "); scanf("%s", chrset); //Get user input for the string & chrset ...

### 30. Problem in finding the greatest no. from array    daniweb.com

#include int main() { int i ,j ,a[5]; for(i=0;i<=4;i++) { printf("\n\tEnter the %dst value of the array: ", i+1); scanf("%d", &a[i]); } j = a[0]; printf("\n\tOriginal array entered by the user: "); for(i=0;i<=4;i++) { printf(" %d ", a[i]); if(a[i]

### 31. arrays...cant find the error in my program    tek-tips.com

Write a program that rolls a six-sided die 6000 times and displays the number of times each face was rolled.so far i have...#include void main ( void ){int index, count, roll ;int face[ 6 ] ;for ( index = 1 ; index <= 5 ; index++ )face[ index ] = 0 ;printf( "Face\tFrequency\n" ) ;printf( "----\t---------\n" ) ;for ( roll = ...