Most answered questions in Programming in C

#201
648
views
2 answers
6 votes
What will be the output of following program ?#include <stdio.h int thefunction(int a) { static int b = 0; b++; a = a + b; return a; } int main() { int b = 0; int i; for ...
#202
1.6k
views
2 answers
1 votes
main() { char *p1="name"; char *p2; p2=(char*)malloc(20); memset(p2,0,20); while(*p2++=*p1++); printf("%s\n",p2); }
#203
348
views
2 answers
0 votes
How to take inputs for a string ?Example:- #include<stdio.h #include<stdlib.h #include<conio.h #include<string.h #define MAX 10000 int main() { char*str; int i,te...
#204
1.4k
views
2 answers
1 votes
Dynamic declaration of 2D arrayint arr=(int ) malloc(r* sizeof(int*));for(i=0; i<r; i++) arr[i]=(int*) malloc(c* sizeof(int));can anyone explain these lines?
#205
3.0k
views
2 answers
2 votes
#include <stdio.h int main() { int a = 1; int b = 1; int c = a || b; printf("%d %d",c,b); }Answer is given 1, 1 but i m having doubt in logical OR operator and uninary ...
#206
428
views
2 answers
2 votes
#207
682
views
2 answers
0 votes
My question is when I give :i/p - abcdehow i get output - abcde .I mean C is a character so shouldn't o/p also be an single character . Why is o/p coming out to be be str...
#208
902
views
2 answers
2 votes
why is it showing error??#include <stdio.h>int main() { extern int i; i=20; printf("%d",i);}
#209
1.3k
views
2 answers
1 votes
I am getting segmentation fault for the following code.Please help to rectify. #include <stdio.h #include <stdlib.h struct person { int age; float weight; char *name; }; ...
#210
1.4k
views
2 answers
1 votes
WAP where smallest subarrays with sum greater than x?Say an array={1,5,6,2,45,17};Now, x=60Now we have to find smallest subarray which is greater than x
#211
4.4k
views
2 answers
1 votes
what is the difference between all these types of trees1)full binary tree 2) complete binary tree 3) almost complete binary tree 4)perfect binary tree 5)strictly binary t...
#212
625
views
2 answers
1 votes
#include <stdio.h int K = 4; int a ; unsigned int m; int* check(unsigned int n) { int res = 1; int count = 0; for(int i=0;i<K;i++) if(!(n&(1<<i))) { count++; res = 0; } a...
#213
1.5k
views
2 answers
0 votes
typedef int (*test)(float*, float*);test tmp; i am unable to understand the code ,please help!
#214
1.3k
views
2 answers
0 votes
#215
1.5k
views
2 answers
0 votes
The library function exit ( ) causes as exit from (a) the loop in which it occurs(b) the block is which it occurs(c) the functions in which it occurs(d) the progam in whi...
#216
1.0k
views
2 answers
0 votes
If the following fragment (assume negative numbers are stored in 2's complement form)unsigned i=1;int j=-4;printf("%u",i+j);prints x then printf("%d", 8*sizeof(int));outp...
#217
2.7k
views
2 answers
2 votes
let x be an array of integer . which of the following can not be present in the left hand side of an assignment statementa)x b) x+i c) * (x+i) d) &x[i]
#218
2.2k
views
2 answers
0 votes
what is the differernce between if (a=0) and if (a= -7) or any other non-zero number e.g what will be the out put of following program a)if ( a=0)printf(""a is zero ")els...
#219
847
views
2 answers
0 votes
#include <stdio.h int total(int v) { static int count=0; while(v){ count+=v&1; v>>=1; } return count; } void main() { // your code goes here static int x=0; int i=5; for(...
#220
5.9k
views
2 answers
3 votes
Given a hash table with n keys and m slots, with the simple uniform hashing assumption (each key is equally likely to be hashed into each slot). Collisions are resolved b...