Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged pointers
0
votes
0
answers
121
awes previous year
Give the output of the following program #include <iostream.h> void main() { int x[]={5,2,6,9,8}; int *p,**q,*t; p=x; t=x+1; q=&t; cout<<endl<<*++p<<" "<<**q<<" "<<*t++; } (a) 1 1 1 1 (b) 5 2 6 (c) 2 6 2 (d) 2 6 9
Give the output of the following program#include <iostream.h>void main(){int x[]={5,2,6,9,8};int *p, q,*t;p=x;t=x+1;q=&t;cout<<endl<<*++p<<" "<< q<<" "<<*t++;}(a) 1 1 1 1...
rohit vishkarma
756
views
rohit vishkarma
asked
Oct 25, 2018
Programming in C
pointers
array-of-pointers
+
–
1
votes
0
answers
122
Explain the following
Please explain this.
Please explain this.
Abhisek Saha
430
views
Abhisek Saha
asked
Oct 14, 2018
Programming in C
programming-in-c
array
pointers
+
–
0
votes
0
answers
123
https://www.sanfoundry.com/multiple-choice-questions-c-pointers-function-arguments/
What is the output of this C code? Please explain what is happening at line no. 12 #include <stdio.h> int main() { int i = 97, *p = &i; foo(&p); printf("%d ", *p); return 0; } void foo(int **p) { int j = 2; *p = &j; printf("%d ", **p); }
What is the output of this C code? Please explain what is happening at line no. 12#include <stdio.h>int main(){int i = 97, *p = &i;foo(&p);printf("%d ", *p);return 0;}voi...
sam.mavux
2.5k
views
sam.mavux
asked
Oct 12, 2018
Programming in C
programming-in-c
pointers
output
+
–
0
votes
1
answer
124
self doubt
++*p and (*p)++ both are same????
++*p and (*p)++both are same????
eyeamgj
469
views
eyeamgj
asked
Oct 3, 2018
Programming in C
programming-in-c
pointers
self-doubt
+
–
1
votes
2
answers
125
MadeEasy Test Series: Programming & DS - Programming In C
Consider the following c-program: #include<stdio.h> int main() { char *arr[ ] ={"GATE", "CAT", "IES", "IAS", "PSU", "IFS" }; call(arr); return 0; } void call (char * ... represent the output of the above program?(Assume size of int,pointer is 4B). A)IES B)IAS C)CAT D)PSU
Consider the following c-program:#include<stdio.h>int main() {char *arr[ ] ={"GATE", "CAT", "IES", "IAS", "PSU", "IFS" };call(arr);return 0;}void call (char ptr) {char ...
talha hashim
2.4k
views
talha hashim
asked
Oct 3, 2018
Programming in C
programming-in-c
array
pointers
made-easy-test-series
+
–
3
votes
2
answers
126
MadeEasy Test Series: Programming & DS - Programming In C
Sakshi Jaiswal
913
views
Sakshi Jaiswal
asked
Oct 1, 2018
Programming in C
made-easy-test-series
programming
pointers
array
+
–
0
votes
1
answer
127
C programming
What is the interpretation of following C declaration: char *(*(**foo[][8])())[]; (A) foo is array of 8 pointer to pointer to function returning pointer to array of pointer to char. (B) foo is array of array of 8 pointer to pointer to function returning ... of char. (C) foo is array of array of 8 pointer to pointer to function returning pointer to array of pointer to char. (D) None
What is the interpretation of following C declaration:char *(*( foo[][8])())[];(A) foo is array of 8 pointer to pointer to function returning pointer to array of pointer ...
sushmita
700
views
sushmita
asked
Sep 30, 2018
Programming in C
output
programming-in-c
programming
pointers
+
–
0
votes
1
answer
128
C programming
What is the output of this program? int main(void) { int a = 10, b = 20, c = 30; printf(" %d..%d..%d ", a+b+c, (b = b*2), (c = c*2)); return 0; } (A) 60..40..60 (B) 110..40..60 (C) 110..20..30 (D) 60..20..30 does sequence point comes into picture here?
What is the output of this program?int main(void){int a = 10, b = 20, c = 30;printf(" %d..%d..%d ", a+b+c, (b = b*2), (c = c*2));return 0;}(A) 60..40..60(B) 110..40..60(C...
sushmita
740
views
sushmita
asked
Sep 29, 2018
Programming in C
programming-in-c
programming
pointers
+
–
0
votes
1
answer
129
2D Array using Double pointers
what is wrong with this code? It shows segmentation fault #include<stdio.h> #include<stdlib.h> void main() { int i,j,count=1; int **a=(int**)malloc(3*sizeof(int*)); for(i=0; i<3; i++) { a[i]=(int*)malloc(4*sizeof(int)); } for(i=0; i<3; i++) { ... 0; i<3; i++) { for(j=0; j<4; j++) { printf("%d ",a[i][j]); } printf("\n"); } }
what is wrong with this code? It shows segmentation fault#include<stdio.h>#include<stdlib.h>void main(){ int i,j,count=1; int a=(int )malloc(3*sizeof(int*)); fo...
aditi19
732
views
aditi19
asked
Sep 13, 2018
Programming in C
programming-in-c
array
array-of-pointers
pointers
+
–
0
votes
0
answers
130
C programming - Type casting
Please explain the output for the following program: #include<stdio.h> int main() { int i = 100; int *a = &i; float *f = (float *)a; (*f)++; printf("%d", *a); //getting some garbage value }
Please explain the output for the following program: #include<stdio.h>int main() { int i = 100; int *a = &i; float *f = (float *)a; (*f)++; pri...
garvit_vijai
685
views
garvit_vijai
asked
Sep 2, 2018
Programming in C
programming-in-c
pointers
output
programming
+
–
0
votes
2
answers
131
self doubt
what is the difference between *(ptr)++ and ptr++ where char *ptr="gateoverflow"
what is the difference between*(ptr)++ and ptr++ where char *ptr="gateoverflow"
nag.swarna
611
views
nag.swarna
asked
Sep 2, 2018
Programming in C
pointers
+
–
1
votes
1
answer
132
syntatactically correct?
consider the two declarations void *voidPtr; char *charPtr; which of the following assignments are syntactically correct? (a)charPtr= voidPtr (b)*charPtr=voidPtr (c)*voidPtr=*charPtr (d)voidPtr=charPtr please explain!
consider the two declarationsvoid *voidPtr;char *charPtr;which of the following assignments are syntactically correct?(a)charPtr= voidPtr(b)*charPtr=voidPtr(c)*voidPtr=*c...
balaganesh
3.9k
views
balaganesh
asked
Aug 31, 2018
Programming in C
pointers
+
–
0
votes
1
answer
133
array long with pointers
give the complete solution with explanation int main() { int arr [2] [2] [2] = {10,2,3,4,5,6,7,8}; int *p, *q; p = &arr[1] [1] [1]; q = (int*) arr; printf("%d ,%d \n",*p ,*q); return 0; }
give the complete solution with explanationint main(){ int arr = {10,2,3,4,5,6,7,8}; int *p, *q; p = &arr ; q = (int*) arr; printf("%d ,%d \n",*p...
shivam sharma 5
549
views
shivam sharma 5
asked
Aug 28, 2018
Programming in C
programming-in-c
pointers
array
+
–
0
votes
0
answers
134
Pointer Doubt
Suppose in P3 the free statement was not present then P3 will not be creating any problem right because when i return p3 it will return basically what its pointing to which is dynamically allocated memory from heap which will be there even though px doesn't exist ... value can be stored in another pointer now Right ?? Right now P3 is the case of Dangling Pointer isn't it ?
Suppose in P3 the free statement was not present then P3 will not be creating any problem right because when i return p3 it will return basically what its pointing to whi...
Na462
226
views
Na462
asked
Aug 22, 2018
DS
programming-in-c
pointers
+
–
13
votes
8
answers
135
Two dimensional array
Consider a 2 dimensional array A[40...95,40...95] in lower triangular matrix representation. The size of each element of array is 1 Byte.If array is implemented in memory as Row major,with base address as 1000,the address of A[66][50] is ..... Ans. 1361
Consider a 2 dimensional array A[40...95,40...95] in lower triangular matrix representation. The size of each element of array is 1 Byte.If array is implemented in memory...
Na462
5.5k
views
Na462
asked
Aug 22, 2018
DS
programming-in-c
array
pointers
data-structures
+
–
1
votes
0
answers
136
Pointers
#include<stdio.h> int main() { char A[5][7][6]; char *p[5][7][6]; printf("%d\t", (unsigned)(A+1)-(unsigned)A); printf("%d", (unsigned)(p+1)-(unsigned)p); } What will be the output ?? 1. 42 ,42 2. 42,336 3. 336,42 4. 1,1
#include<stdio.h>int main(){char A[5][7][6];char *p[5][7][6];printf("%d\t", (unsigned)(A+1)-(unsigned)A);printf("%d", (unsigned)(p+1)-(unsigned)p);}What will be the outpu...
Solarica Palit
296
views
Solarica Palit
asked
Aug 19, 2018
Programming in C
pointers
+
–
0
votes
1
answer
137
Pointers in C
What is a variable pointer? please note the question is not asking about pointer variables, but the specific term.
What is a variable pointer? please note the question is not asking about pointer variables, but the specific term.
Prakhar Yadav 1
500
views
Prakhar Yadav 1
asked
Aug 6, 2018
Programming in C
programming-in-c
pointers
+
–
1
votes
2
answers
138
Self doubt
What are the minimum number of pointers required to implement a stack using single ended queue ( the queue is NOT a dequeue )?
What are the minimum number of pointers required to implement a stack using single ended queue ( the queue is NOT a dequeue )?
kapilbk1996
1.1k
views
kapilbk1996
asked
Jul 26, 2018
DS
stack
queue
data-structures
pointers
+
–
0
votes
0
answers
139
Programming
int main(){ int arr[3]={2,3,4}; char *p; p = (char*)arr; printf("%d",*p); p=p+1; printf("%d",*p); return 0; }
int main(){int arr[3]={2,3,4};char *p;p = (char*)arr;printf("%d",*p);p=p+1;printf("%d",*p);return 0;}
Ankish Gupta 3
678
views
Ankish Gupta 3
asked
Jul 22, 2018
Programming in C
programming-in-c
programming
pointers
+
–
0
votes
1
answer
140
Programming
main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p+++*str1-32); } output is 76 pls explain.
main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p+++*str1-32); }output is 76 pls explain.
Ankish Gupta 3
701
views
Ankish Gupta 3
asked
Jul 20, 2018
Programming in C
programming-in-c
pointers
array-of-pointers
+
–
0
votes
3
answers
141
Arrays
Int A[3]={0,1,2} A++; For this code snippet un C will there be a compilation error,if yes then please explain a bit.
Int A[3]={0,1,2}A++; For this code snippet un C will there be a compilation error,if yes then please explain a bit.
hrcule
589
views
hrcule
asked
Jul 20, 2018
Programming in C
array
pointers
programming
+
–
0
votes
2
answers
142
C programming
#include <stdio.h> main() { char *p = "Sanfoundry C-Test"; p[0] = 'a'; p[1] = 'b'; printf("%s", p); }
#include <stdio.h main() { char *p = "Sanfoundry C-Test"; p[0] = 'a'; p = 'b'; printf("%s", p); }
shiva0
2.2k
views
shiva0
asked
Jul 18, 2018
Others
programming-in-c
pointers
+
–
0
votes
2
answers
143
C programming
What is the value of the following expression? main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); } (A) 1 1 (B)1 2 (C) 2 3 Ans given option a pls explain.
What is the value of the following expression? main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); } (A) 1 1 (B)1 2 (...
Ankish Gupta 3
1.4k
views
Ankish Gupta 3
asked
Jul 15, 2018
Programming in C
programming-in-c
programming
pointers
+
–
1
votes
1
answer
144
Multi-dimensional Array
Can anyone please verify whether I have calculated the addresses correctly or not?
Can anyone please verify whether I have calculated the addresses correctly or not?
Balaji Jegan
938
views
Balaji Jegan
asked
Jun 27, 2018
Programming in C
pointers
programming
array
+
–
0
votes
1
answer
145
gate forum test series
kunal goswami
455
views
kunal goswami
asked
Jun 19, 2018
Programming in C
pointers
gateforum-test-series
+
–
0
votes
0
answers
146
self doubt:- c++
Please explain the working of this code:- #include<iostream> using namespace std; class Base { public: int x; Base():x(10){} ~Base(){} }; class Derived:public Base { public: int y; Derived():y(20){} ~Derived(){} }; int main() { Base bobj,*bptr; ... (Derived*)&bobj; cout<<dptr->x<<endl; cout<<dptr->y<<endl; } Output:-10 10 0 [Finished in 2.7s]
Please explain the working of this code:- #include<iostream using namespace std; class Base { public: int x; Base():x(10){} ~Base(){} }; class Derived:public Base { publi...
kd.....
269
views
kd.....
asked
May 12, 2018
Object Oriented Programming
programming
inheritance
pointers
+
–
0
votes
3
answers
147
C programming
#include<stdio.h> #include<stdlib.h> #include<conio.h> int * show(); int main() { int *p=show(); //clrscr(); printf("%d",*p); } int * show() { int x=10; /*int *p; p=(int *)malloc(4); *p=x;*/ return &x; } Here as the $show()$ ends variable $x$ gets destroyed but still I am able to access its value why is it so?
#include<stdio.h #include<stdlib.h #include<conio.h int * show(); int main() { int *p=show(); //clrscr(); printf("%d",*p); } int * show() { int x=10; /*int *p; p=(int *)m...
kd.....
1.0k
views
kd.....
asked
Apr 27, 2018
Programming in C
programming-in-c
programming
output
pointers
+
–
0
votes
1
answer
148
C programming
Declare a function prototype which will do 1)recives two integer and float 2)return address of array of integers. Please also explain it
Declare a function prototype which will do1)recives two integer and float2)return address of array of integers.Please also explain it
kd.....
474
views
kd.....
asked
Apr 25, 2018
Programming in C
programming-in-c
programming
pointers
+
–
4
votes
1
answer
149
pointers and arrays
Why is it illegal initialization? #include<stdio.h> #include<string.h> main() { char *s[]={"Lakshya","cquest","brainq","cidol"}; char **ss[]={(s+3),(s+2),(s+1),(s+0)}; char ***sss=ss; printf("%s",**++sss); printf("%s",*--*++sss+3); printf("%s",sss[-1][-1]+1); }
Why is it illegal initialization?#include<stdio.h #include<string.h main() { char *s[]={"Lakshya","cquest","brainq","cidol"}; char ss[]={(s+3),(s+2),(s+1),(s+0)}; char ...
kd.....
1.2k
views
kd.....
asked
Apr 25, 2018
Programming in C
pointers
array
programming
array-of-pointers
programming-in-c
+
–
1
votes
1
answer
150
My doubt : String constant related doubt
"If a string constant is given then through by a pointer we can access the characters but we can't change any of the characters" Can someone please expain this?
"If a string constant is given then through by a pointer we can access the characters but we can't change any of the characters"Can someone please expain this?
Akash Kumar Roy
373
views
Akash Kumar Roy
asked
Apr 21, 2018
Programming in C
strings
string-constant
pointers
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register