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
Recent questions in Programming and DS
0
votes
1
answer
3421
strings in C
I am trying to implement strcpy manually but am getting error. What is the error? Please help! #include<stdio.h> char* cpy(char *a,char *b) { char *arr; arr=&a; while((*a++=*b++)!='\0'); printf("%s", arr); } int main() { char s[15]="Sreeja"; char t[15]="Mukherjee"; cpy(&s,&t); }
I am trying to implement strcpy manually but am getting error. What is the error? Please help! #include<stdio.h char* cpy(char *a,char *b) { char *arr; arr=&a; ...
Bongbirdie
982
views
Bongbirdie
asked
May 2, 2017
Programming in C
programming-in-c
strings
+
–
0
votes
1
answer
3422
Please explain already answered Question
Link to the question - https://gateoverflow.in/20611/tifr2011-b-30 Someone please simplify that question and explain.
Link to the question - https://gateoverflow.in/20611/tifr2011-b-30Someone please simplify that question and explain.
iarnav
486
views
iarnav
asked
May 2, 2017
DS
array
data-structures
+
–
0
votes
1
answer
3423
relational operator
Why is the answer a).Answer should be c.Please tell if I am wrong...
Why is the answer a).Answer should be c.Please tell if I am wrong...
Aakash1125
326
views
Aakash1125
asked
May 2, 2017
4
votes
1
answer
3424
IIITH - PGEE 2017
main() { int c=0,x,i,y; for(i=0;i<N;i++) { x=random();y=random(); if((x2+y2)<1) c++; } print(c); } random() is a function which returns random number between $0$ or $1$, $N$ is a large number what is the output of the program?
main() { int c=0,x,i,y; for(i=0;i<N;i++) { x=random();y=random(); if((x2+y2)<1) c++; } print(c); }random() is a function which returns random number b...
dragonball
2.4k
views
dragonball
asked
May 2, 2017
Programming in C
programming-in-c
iiith-pgee
+
–
0
votes
1
answer
3425
linked list
What is the correct option?? dummy header is sometimes used to point first node and sometime last but here I don,t know what is correct option?
What is the correct option??dummy header is sometimes used to point first node and sometime last but here I don,t know what is correct option?
Aakash1125
2.7k
views
Aakash1125
asked
May 1, 2017
1
votes
3
answers
3426
linked list
I think option should be a) but given is c.here head pointer point the first node whereas tail pointer point the last node And if want to delete the first element then element will be deleted but head pointer will be free.then how to head pointer point the first node/element.Pls tell what is correct??
I think option should be a) but given is c.here head pointer point the first node whereas tail pointer point the last node And if want to delete the first element then el...
Aakash1125
828
views
Aakash1125
asked
Apr 30, 2017
0
votes
1
answer
3427
function
What is this statement means ?? what is correct option??
What is this statement means ?? what is correct option??
Aakash1125
576
views
Aakash1125
asked
Apr 30, 2017
Programming in C
bad-question
+
–
0
votes
0
answers
3428
MargeSort Algorithm Implementation
#include<stdio.h> void mergeArray(int arr[],int l,int m,int r) { int n1=m-l+1; int n2=r-m; int Larr[n1]; int Rarr[n2]; int i,j,k; for(i=0;i<n1;i++) Larr[i]=arr[l+i]; for(j=0;j<n2;j++) Rarr[j]=arr[m+1+j]; i=0; j=0; ... 0; } In this code when i am giving the input n=5; 2 3 1 4 5 than it will give 1 2 3 1 2 where is the problem can anyone explain ?
#include<stdio.h>void mergeArray(int arr[],int l,int m,int r){int n1=m-l+1;int n2=r-m;int Larr[n1];int Rarr[n2];int i,j,k;for(i=0;i<n1;i++) Larr[i]=arr[l+i];for(j=0;j<...
Nitesh Choudhary
364
views
Nitesh Choudhary
asked
Apr 29, 2017
Programming in C
algorithms
merge-sort
+
–
2
votes
1
answer
3429
C programming - Output ?
Assume sizeof int as 4 #include <stdio.h> unsigned int L = (sizeof(unsigned int)) << 3; int foo(unsigned int m,unsigned int start,unsigned int length) { length = length >> 1; if(!length) { return m&(1<<start)?1:0; }else { int n1 = foo( ... (m,start+length,length); return n1+n2; } } int main() { int m = 100; printf("%d\n",foo(m,0,L)); }
Assume sizeof int as 4#include <stdio.h unsigned int L = (sizeof(unsigned int)) << 3; int foo(unsigned int m,unsigned int start,unsigned int length) { length = length > 1...
dd
1.1k
views
dd
asked
Apr 29, 2017
Programming in C
programming-in-c
output
+
–
1
votes
1
answer
3430
How to find address of an element in array in Binary
Let's say we have an array of 5 elements. Array index starts from 0 Base address of Array = 100 size of each element is 2 ie it's an int array Now we want to find the 2nd element ie A[2]. So, the procedure is like - A[2] ... element in memory) A[2] = 100+(2*2) Now how to find the BOLD text ie address of 2nd element in BINARY?! Thanks
Let's say we have an array of 5 elements.Array index starts from 0 Base address of Array = 100 size of each element is 2 ie it's an int arrayNow we want to find the 2nd e...
iarnav
1.9k
views
iarnav
asked
Apr 28, 2017
Programming in C
data-structures
array
+
–
0
votes
3
answers
3431
while loop
what does following code mean if j=0 and a and b are two character pointers to two strings: while(a[j]&&b[j])
what does following code mean if j=0 and a and b are two character pointers to two strings: while(a[j]&&b[j])
nabadeep
607
views
nabadeep
asked
Apr 27, 2017
0
votes
0
answers
3432
C programming
What does the following program print? #include < stdio.h > void f (int *p, int * g) { p = q; *p = 2; } int i = 0, j = 1; int main ( ){ f(&i, & j); printf ("%d %d \ n", i, j); return 0; }
What does the following program print?#include < stdio.h >void f (int *p, int * g) {p = q;*p = 2;}int i = 0, j = 1;int main ( ){f(&i, & j);printf ("%d %d \ n", i, j);retu...
shalini j
429
views
shalini j
asked
Apr 27, 2017
0
votes
0
answers
3433
pointer to array
how this question gives -3? according to rule both pointers must pointing to same array then only difference ie ptr1-ptr2 is used but here how answer always is -3??? Turbo c also giving -3.
how this question gives -3? according to rule both pointers must pointing to same array then only difference ie ptr1-ptr2 is used but here how answer always is -3???Turbo...
Aakash1125
850
views
Aakash1125
asked
Apr 26, 2017
0
votes
1
answer
3434
Modified form of gate - 2000 , ISRO 2015
#include<stdio.h> struct { short x[5]; union { float y; long z; }u; }t; int main() { printf("short=%d\n",sizeof(short)); printf("float=%d\n",sizeof(float)); printf("long=%d\n",sizeof(long)); printf("%d", ... } Answer should be 14 but why the answer is 16 ? Note : short : 2 bytes , float : 4 bytes , long : 4 bytes
#include<stdio.h struct { short x[5]; union { float y; long z; }u; }t; int main() { printf("short=%d\n",sizeof(short)); printf("float=%d\n",sizeof(float)); printf("long=%...
dragonball
487
views
dragonball
asked
Apr 26, 2017
4
votes
1
answer
3435
Problem with Linked List Code
I was trying to implement the Linked List code in C. It compiles fine but doesn't give any output. What seems to be the error? I think I messed up at passing pointer references as function parameters. My Code (Insert At Beginning): ... node(pointer to pointer) to the function. - Return the modified head node by the function. Please read about Reference Semantics.
I was trying to implement the Linked List code in C. It compiles fine but doesn't give any output. What seems to be the error? I think I messed up at passing pointer refe...
RahulVerma
1.0k
views
RahulVerma
asked
Apr 26, 2017
Programming in C
algorithms
linked-list
data-structures
programming-in-c
+
–
0
votes
1
answer
3436
What is the difference between #include<stdio.h> and #include "stdio.h".
What is the difference between #include<stdio.h> and #include "stdio.h".
What is the difference between #include<stdio.h and #include "stdio.h".
Nitesh Choudhary
1.1k
views
Nitesh Choudhary
asked
Apr 25, 2017
Programming in C
programming-in-c
programming-in-c
+
–
0
votes
1
answer
3437
C Program Query
#include <stdio.h> #include <math.h> int main() { int number, originalNumber, remainder, result = 0, n = 0 ; printf("Enter an integer: "); scanf("%d", &number); originalNumber = number; while (originalNumber != 0) { ... will be false while (originalNumber != 0) { remainder = originalNumber%10; result += pow(remainder, n); originalNumber /= 10; }
#include <stdio.h #include <math.h int main() { int number, originalNumber, remainder, result = 0, n = 0 ; printf("Enter an integer: "); scanf("%d", &number); originalNum...
iarnav
437
views
iarnav
asked
Apr 25, 2017
Programming in C
programming-in-c
+
–
0
votes
1
answer
3438
C programming doubt
#include <stdio.h> int main() { int n, i; unsigned long long factorial = 1; printf("Enter an integer: "); scanf("%d",&n); // show error if the user enters a negative integer if (n < 0) printf("Error! Factorial of a negative ... } return 0; } Doubt 1 = Why we initialized i=2 and not i=1 Doubt 2 = What if user enter the integer as 0 Thanks!
#include <stdio.h int main() { int n, i; unsigned long long factorial = 1; printf("Enter an integer: "); scanf("%d",&n); // show error if the user enters a negative integ...
iarnav
440
views
iarnav
asked
Apr 24, 2017
2
votes
1
answer
3439
time complexity
T(n)=2.T((n)^(1/2)) + log ((n)^(1/2)) whats the time complexity?????????????????????????/
T(n)=2.T((n)^(1/2)) + log ((n)^(1/2))whats the time complexity?????????????????????????/
akankshadewangan24
350
views
akankshadewangan24
asked
Apr 24, 2017
Programming in C
time-complexity
+
–
0
votes
2
answers
3440
order of precedence
Please tell why answer is (d)?
Please tell why answer is (d)?
Aakash1125
2.6k
views
Aakash1125
asked
Apr 23, 2017
Page:
« prev
1
...
167
168
169
170
171
172
173
174
175
176
177
...
310
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register