Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x.
...
Share
Given an array of n elements, where each element is at most k away from its target position, devise an algorithm that sorts in O(n log k) time. For example, let us ...
Share
Consider the below program.
#include<stdio.h>
void fun(int arr[])  
{
  int i;   
  
  /* s...
Share
The C99 standard allows variable sized arrays (see this). But, unlike the normal arrays, variable sized arrays cannot be initialized.
For example, the following pro...
Share
In C/C++, when a character array is initialized with a double quoted string and array size is not specified, compiler automatically allocates one extra space for stri...
Share
In C/C++, initialization of a multidimensional arrays can have left most dimension as optional. Except the left most dimension, all other dimensions must be specifie...
Share
We have introduced arrays in set 1 (Introduction to arrays in C).
In this post array properties in C are discussed.
1) In C, it is possible to have array of all types...
Share
In C/C++, we can assign a struct (or class in C++ only) variable to another variable of same type. When we assign a struct variable to another, all members of the va...
Share
Pointers are used for storing address of dynamically allocated arrays and for arrays which are passed as arguments to functions. In other contexts, arrays and pointe...
Share
In C, it is possible to have array of all types except following.
1) void.
2) functions.
For example, below program throws compiler error
int main()
{
void arr[10...
Share