About 2,870,000 results
Open links in new tab
  1. C - Counting the occurrence of same number in an array

    Oct 3, 2018 · I have an array in C where: int buf[4]; buf[0] = 1; buf[1] = 2; buf[2] = 5; buf[3] = 2; and I want to count how many elements in the array that have the same value with a counter. …

  2. Counting frequencies of array elements - GeeksforGeeks

    Oct 3, 2023 · Given an unsorted array, count all distinct elements in it. Examples: Input : arr[] = {10, 20, 20, 10, 30, 10} Output : 3 Input : arr[] = {10, 20, 20, 10, 20} Output : 2 We have …

  3. C program to count frequency of each element in an array

    Jul 17, 2015 · Finding frequency of each array element is based on logic to find duplicate elements in array. Step by step descriptive logic to count frequency of each element of array. …

  4. C Program to Count Occurrence of an Element in an Array

    Write a C program to count occurrence of an element in an array using the for loop, while loop, and do while with an example.

  5. Count elements in array in C - Stack Overflow

    Jan 6, 2012 · There are 5 (five) elements in your array, thus getting array length and dividing it by the size of a single element yields five: int str_numbers[5] = {1,4,8,2,9}; int total = …

  6. C Program Count Number of Duplicate Elements in An Array | C

    Apr 15, 2025 · C program to count the total number of duplicate elements in an array – In this article, we will discuss the numerous methods to count the total number of duplicate elements …

  7. C Program to Count Total Duplicate Elements in an Array

    C Program to Count Total Duplicate Elements in an Array Example. This program asks the user to enter Array Size and array elements. Next, it is going to count the total number of duplicate …

  8. Count Distinct ( Unique ) elements in an array - GeeksforGeeks

    Jun 12, 2024 · Given an array arr[] consisting of N positive integers and a positive integer K, the task is to find the count of array elements whose distinct digits are a subset of the digits of K. …

  9. How to count number of same array elements in c++?

    Apr 19, 2018 · At first you sort your array, and then you count repetitions with a comparer while std::unique() removes repetitions from the array. The code can store the count of unique …

  10. Array element count in C - Stack Overflow

    Jan 14, 2016 · Even if pragma pack directive is used in your source, possibly causing the packing to change (which can also affect alignment), resulting in a different value for sizeof for each …

  11. Some results have been removed
Refresh