Highest voted questions in Programming and DS

1 votes
0 answers
2671
int main(){ int i = 10; int *p = &i; foo(&p); printf("%d ", *p); printf("%d ", *p);}void foo(int const p){ int j = 11; *p = &j; printf("%d ", p);}Output is...
1 votes
3 answers
2673
void main() { unsigned char var=0; for(var=0;var<=255;var++) { printf("%d ",var); } }What is output of this code?
1 votes
2 answers
2674
main() { char *p1="name"; char *p2; p2=(char*)malloc(20); memset(p2,0,20); while(*p2++=*p1++); printf("%s\n",p2); }
1 votes
1 answer
2675
what is the output of the following program ??
1 votes
2 answers
2676
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?
1 votes
5 answers
2679
1 votes
1 answer
2680
What will be the output of the following C program? If you think it will give a runtime error, you need to mention it. In either case,your answer must include proper just...
1 votes
1 answer
2683
1 votes
1 answer
2685
Write an algorithm of the given problemGiven a chess board of order NxM and source points (s1,s2) and destination points (d1,d2), Your task to find min number of moves re...
1 votes
2 answers
2686
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
1 votes
2 answers
2687
1 votes
1 answer
2689
Can someone explain the difference between abstraction and encapsulation with programming example?
1 votes
1 answer
2690
int main(){ int a[5]={1,2,3,4,5}; char *str="hello"; printf("%p %p",a,&a); printf("%p %p",str,&str); }Why in $1$st printf , both the outputs are same($a$,&$a$)And in $2$n...