Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Highest voted questions in Programming and DS
1
votes
0
answers
2581
data structures
Somewhere I read that we cann't get addresses of constants or expressions as these are not saved in memory (regarding C), we can get addresses of variables or structures only.But constants are saved in data segment of a process which is saved in memory then why cann't we get address of a constant?
Somewhere I read that we cann't get addresses of constants or expressions as these are not saved in memory (regarding C), we can get addresses of variables or structures ...
sumit_kumar
376
views
sumit_kumar
asked
Jul 28, 2017
DS
data-structures
pointers
+
–
1
votes
1
answer
2582
Pointer Casting
Analyze what is happening and why? int *ptr=(int*)0X12341230; int *ptr2=((int*)(((char*)ptr)+1)); char *ptr=(char*) 0X12341230; void *ptr2=ptr+1;
Analyze what is happening and why?int *ptr=(int*)0X12341230; int *ptr2=((int*)(((char*)ptr)+1));char *ptr=(char*) 0X12341230; void *ptr2=ptr+1;
srestha
422
views
srestha
asked
Jul 27, 2017
Programming in C
programming-in-c
programming
pointers
+
–
1
votes
0
answers
2583
Small Doubt on C
How can we do casting a pointer? Will that not give error?
How can we do casting a pointer? Will that not give error?
srestha
242
views
srestha
asked
Jul 27, 2017
Programming in C
programming-in-c
+
–
1
votes
0
answers
2584
File input output
int main(void) { // your code goes here int main() { FILE *fp; char ch, str[7]; fp=fopen("test.c", "r"); /* file 'try.c' contains "This is manipal" */ fseek(fp, 9L, SEEK_CUR); fgets(str, 5, fp); puts(str); return 0;
int main(void) { // your code goes here int main(){FILE *fp;char ch, str[7];fp=fopen("test.c", "r"); /* file 'try.c' contains "This is manipal" */fseek(fp, 9L, SEEK...
Purnima Digra
341
views
Purnima Digra
asked
Jul 26, 2017
Programming in C
non-gate
+
–
1
votes
1
answer
2585
algorithm
some random numbers are given and asked to construct a balanced BST..what will be the time complexity? numbers in sorted order are given and asked to construct a balanced BST...what will be the time complexity??
some random numbers are given and asked to construct a balanced BST..what will be the time complexity?numbers in sorted order are given and asked to construct a balanced ...
A_i_$_h
297
views
A_i_$_h
asked
Jul 25, 2017
DS
data-structures
binary-search-tree
time-complexity
+
–
1
votes
1
answer
2586
basic C doubt
What is difference between declaration and definition ...in c ? please explain with examples
What is difference between declaration and definition ...in c ?please explain with examples
sid1221
352
views
sid1221
asked
Jul 24, 2017
1
votes
2
answers
2587
void pointer
#include<stdio.h> int main() { int a[2] = {1, 2}; void *ptr = &a; ptr = ptr + sizeof(int); printf("%d", *(int *)ptr); return 0; } what will be output ... explain in detail
#include<stdio.h>int main(){ int a = {1, 2}; void *ptr = &a; ptr = ptr + sizeof(int); printf("%d", *(int *)ptr); return 0;}what will be output ... explain...
sid1221
885
views
sid1221
asked
Jul 24, 2017
1
votes
1
answer
2588
C_program_call_by_value
#include<stdio.h> void main() { int a=5; int b=f(a); printf("%d",b); } int f(int x) { x=+5; return x; } Give output with explanation
#include<stdio.h>void main(){ int a=5; int b=f(a); printf("%d",b);}int f(int x){ x=+5; return x;}Give output with explanation
Gate Ranker18
296
views
Gate Ranker18
asked
Jul 21, 2017
1
votes
1
answer
2589
Dennis Ritchie-page-20,chap-1,1.7 Function
A function need not return a value;a return statement with no expression causes control,but no useful value,to be returned to the caller,as does "falling off the end" of a function by reaching the terminating right brace.And the ... statement with no expression*/ } What is the reason of such output,and what the given statements want to say?
A function need not return a value;a return statement with no expression causes control,but no useful value,to be returned to the caller,as does "falling off the end" of ...
BIPLAB DAS
548
views
BIPLAB DAS
asked
Jul 20, 2017
Programming in C
programming-in-c
+
–
1
votes
1
answer
2590
arrays
Given a set of n elements not all distinct, the majority element is the one with frequency >=n/2. So majority element is always the a. Maximum element b. Minimum element c. Mean element d. Median element
Given a set of n elements not all distinct, the majority element is the one with frequency >=n/2. So majority element is always thea. Maximum elementb. Minimum elementc....
mayur ganatra 1
446
views
mayur ganatra 1
asked
Jul 18, 2017
DS
drdo-2008
+
–
1
votes
1
answer
2591
Dennis Ritchie book 'THE C PROGRAMMING LANGUAGE' EXERCISE-1-8,PAGE-20,CHAPTER-1.
#include<stdio.h> main() { int c,nb,nt,nn; nb=0; nt=0; nn=0; while((c=getchar())!=EOF) if(c==' ') ++nb; else if(c=='\t') ++nt; else if(c=='\n') ++ ... t%d\t%d",nb,nt,nn); } the program does not show output for corresponding string input in Dev C++.Can anyone please answer this?
#include<stdio.h>main(){ int c,nb,nt,nn; nb=0; nt=0; nn=0; while((c=getchar())!=EOF) if(c==' ') ++nb; else if(c=='\t') ++nt; ...
BIPLAB DAS
843
views
BIPLAB DAS
asked
Jul 18, 2017
Programming in C
programming-in-c
+
–
1
votes
2
answers
2592
C programme (OUTpUT ??)
Please tell the output with explanation! #include<stdio.h> int main() { int a,b; printf("%d ",12); printf("%d ",143); printf("%d ",scanf("%d%d",&a,&b)); }
Please tell the output with explanation!#include<stdio.h>int main(){int a,b;printf("%d ",12);printf("%d ",143);printf("%d ",scanf("%d%d",&a,&b));}
Sanyam Lakhanpal
453
views
Sanyam Lakhanpal
asked
Jul 18, 2017
1
votes
0
answers
2593
on size of structure
Please tell the output with explanation! #include<stdio.h> struct s { unsigned a:5; unsigned b:5; unsigned c:5; unsigned d:5; }v={1, 2}; main() { printf("size of v = %d",sizeof(v)); return 0; }
Please tell the output with explanation!#include<stdio.h>struct s{ unsigned a:5; unsigned b:5; unsigned c:5; unsigned d:5;}v={1, 2};main(){ printf("size of v =...
Sanyam Lakhanpal
295
views
Sanyam Lakhanpal
asked
Jul 18, 2017
1
votes
1
answer
2594
Graph theory
if t is a complete n tree with exactly three level ,prove that the no. of vertices of t must be 1+kn,where 2<=k<=n+1
if t is a complete n tree with exactly three level ,prove that the no. of vertices of t must be 1+kn,where 2<=k<=n+1
Ravi prakash pandey
366
views
Ravi prakash pandey
asked
Jul 17, 2017
1
votes
2
answers
2595
Complete Binary tree
What exactly is a Complete Binary Tree? Different sources provide different definitions: Source 1 : A complete binary tree of depth d is the strictly binary tree all of whose leaves are at level d. http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/ ... which case they call this type of tree an almost complete binary tree or nearly complete binary tree. Which definition to follow ?
What exactly is a Complete Binary Tree?Different sources provide different definitions:Source 1 :A complete binary tree of depth d is the strictly binary tree all of whos...
VS
1.6k
views
VS
asked
Jul 16, 2017
DS
self-doubt
+
–
1
votes
1
answer
2596
#dennis
#include<stdio.h> void print1(void){ static int x=10; x+=5; printf("%d",x); } void print2(void){ static int x; x=10; x+=5; printf("%d",x); } int main(){ print1(); print1(); print2(); print2(); getch(); return 0; } please let me know how print1 and print2 is working?
#include<stdio.h>void print1(void){static int x=10;x+=5;printf("%d",x);}void print2(void){static int x;x=10;x+=5;printf("%d",x);}int main(){print1();print1();print2();pri...
saxena0612
891
views
saxena0612
asked
Jul 15, 2017
Programming in C
programming-in-c
pointers
+
–
1
votes
1
answer
2597
Explain the given C program.
<code>#include <stdio.h> int main() { unsigned int b = 20; b = ~b; printf("%d\n", b); }</code>
<code>#include <stdio.h int main() { unsigned int b = 20; b = ~b; printf("%d\n", b); }</code>
Aghori
1.1k
views
Aghori
asked
Jul 14, 2017
Programming in C
programming-in-c
+
–
1
votes
1
answer
2598
recursion
gabbar
1.7k
views
gabbar
asked
Jul 14, 2017
Programming in C
recursion
programming-in-c
+
–
1
votes
1
answer
2599
The process of accessing data stored in a serial access memory is similar to manipulating data on a
The process of accessing data stored in a serial access memory is similar to manipulating data on a (A) heap (B) queue (C) stack (D) binary tree
The process of accessing data stored in a serial access memory is similar to manipulating data on a(A) heap (B) queue(C) stack ...
Meenakshi Sharma
23.9k
views
Meenakshi Sharma
asked
Jul 11, 2017
1
votes
0
answers
2600
C programming
#include <stdio.h> int main() { int i =258; int *iptr = &i; printf("%d%d",*((char*)iptr),*((char*)iptr+1)); return 0; } (a)2,1 (b)2,5 (c)1, 2 (d)5,2 I am getting (a) as output sh-4.2$ gcc -o main *.c sh-4.2$ main 21 Can anybody explain that how we got that? Thanks :)
#include <stdio.h int main() { int i =258; int *iptr = &i; printf("%d%d",*((char*)iptr),*((char*)iptr+1)); return 0; }(a)2,1 (b)2,5(c)1, 2 (d)5,2I am getting (a) as out...
Himanshu Goyal
1.7k
views
Himanshu Goyal
asked
Jul 10, 2017
Programming in C
programming-in-c
output
pointers
+
–
Page:
« prev
1
...
125
126
127
128
129
130
131
132
133
134
135
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register