Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged pointers
0
votes
0
answers
241
c programming
What is the output of this C code?
What is the output of this C code?
vaishali jhalani
556
views
vaishali jhalani
asked
Nov 9, 2016
Programming in C
programming-in-c
output
pointers
+
–
1
votes
1
answer
242
C programming
#include <stdio.h> int main() { short int a[10]; int i=0; for(i=0;i<10;i++) a[i] = 300 + i; char *c = (char*)a; printf("%d\n", *(c+4)); int *n = (int*)a; printf("%d\n",*(n)); } output ?
#include <stdio.h int main() { short int a[10]; int i=0; for(i=0;i<10;i++) a[i] = 300 + i; char *c = (char*)a; printf("%d\n", *(c+4)); int *n = (int*)a; printf("%d\n",*(n...
dd
805
views
dd
asked
Oct 19, 2016
Programming in C
programming-in-c
output
pointers
+
–
4
votes
2
answers
243
GATE Overflow | Programming | Test 1 | Question: 10
What will be the output of the following program? #include <stdio.h> void f1(int p1, int *p2, int **p3) { p1 = 20; *p2 = p1; **p3 = *p2; p1 = 10; } int main() { int a = 5, b = 5, *c = &b; f1(a, &b, &c); printf("%d %d %d", a, b, *c); } 5 5 5 5 20 20 10 20 20 20 20 20
What will be the output of the following program?#include <stdio.h void f1(int p1, int *p2, int p3) { p1 = 20; *p2 = p1; p3 = *p2; p1 = 10; } int main() { int a = 5, b ...
Arjun
838
views
Arjun
asked
Oct 18, 2016
Programming in C
go-programming-1
programming
programming-in-c
pointers
+
–
6
votes
2
answers
244
GATE Overflow | Programming | Test 1 | Question: 8
What is the output of this program? #include <stdio.h> int main() { char *ptr; char string[] = "Hello 2017"; ptr = string; ptr += 4; printf("%s",++ptr); } Hello 2017 ello 2017 2017 o 2017
What is the output of this program?#include <stdio.h int main() { char *ptr; char string[] = "Hello 2017"; ptr = string; ptr += 4; printf("%s",++ptr); }Hello 2017ello 201...
Arjun
679
views
Arjun
asked
Oct 18, 2016
Programming in C
go-programming-1
programming
programming-in-c
pointers
+
–
8
votes
2
answers
245
GATE Overflow | Programming | Test 1 | Question: 2
Consider the following C function: void foo() { int a[10][20][30] = {0}; __________ printf("%d", a[3][4][5]); } Which of the following could be used in the missing line so that the output is 2? a[3][4][5] = 2; *(*(*(a+3) + 4) + 5) = 2; (*(*(a ... *((int*)a + 3 * 20 * 30 + 4 * 30 + 5) = 2; Only 1 and 2 Only 1, 2 and 3 Only 1 1, 2, 3 and 4
Consider the following C function:void foo() { int a[10][20][30] = {0}; __________ printf("%d", a[3][4][5]); }Which of the following could be used in the missing line so ...
Arjun
1.4k
views
Arjun
asked
Oct 18, 2016
Programming in C
go-programming-1
programming
programming-in-c
pointers
+
–
1
votes
2
answers
246
..
What is the output of the following C code int main( ) { int p[5] = {10, 11, 12, 13, 14}; int *ptr = (int *) (&p + 1); printf(“%d %d”, *(p + 1), *(ptr – 1)); }
What is the output of the following C code int main( ) { int p[5] = {10, 11, 12, 13, 14}; int *ptr = (int *) (&p + 1); printf(“%d %d”, *(p + 1), *(ptr – 1)); }
Rohan Mundhey
655
views
Rohan Mundhey
asked
Oct 9, 2016
Programming in C
pointers
+
–
2
votes
1
answer
247
Kerala PSC AP exam
int main() { int *r2; void abc(int **); abc(&r2); printf("%d",*r2); } void abc(int **r3) { int r1=5; /* add statements here */ } Which statement is added to the above program such that the address of r1 gets stored in r2? A) *r2 = &r1; B)*r1 = &r3; C) *r3 = &r1; D) None of these
int main() { int *r2; void abc(int ); abc(&r2); printf("%d",*r2); } void abc(int r3) { int r1=5; /* add statements here */ }Which statement is added to the above progra...
Sankaranarayanan P.N
858
views
Sankaranarayanan P.N
asked
Sep 28, 2016
Programming in C
programming-in-c
pointers
+
–
2
votes
0
answers
248
Why does these functions behave diffrently ?
#include <stdio.h> void fun(int* p) { *p = 10; } void fun1(int *p) { int a = 10; p = &a; } int main() { int x = 30; int *p = &x; fun1(p); printf("%d\n",*p); // output = 30 fun(p); printf("%d",*p); // output = 10 }
#include <stdio.h void fun(int* p) { *p = 10; } void fun1(int *p) { int a = 10; p = &a; } int main() { int x = 30; int *p = &x; fun1(p); printf("%d\n",*p); // output = 30...
robertSingh
277
views
robertSingh
asked
Sep 28, 2016
Programming in C
programming
programming-in-c
pointers
+
–
0
votes
1
answer
249
UGC NET CSE | August 2016 | Part 2 | Question: 12
The following $'C'$ statement : int * f[]() declares : A function returning a pointer to an array of integers. Array of functions returning pointers to integers. A function returning an array of pointers to integers. An illegal statement.
The following $'C'$ statement :int * f[]()declares :A function returning a pointer to an array of integers.Array of functions returning pointers to integers.A function re...
makhdoom ghaya
963
views
makhdoom ghaya
asked
Sep 24, 2016
Programming and DS
ugcnetcse-aug2016-paper2
programming-in-c
array-of-pointers
pointers
+
–
0
votes
1
answer
250
Array of pointers
Please help me out guys
Please help me out guys
mohit chawla
571
views
mohit chawla
asked
Sep 18, 2016
Unknown Category
array-of-pointers
programming-in-c
pointers
+
–
0
votes
1
answer
251
UGC NET CSE | June 2010 | Part 2 | Question: 12
What will be the output of the following c-code? void main () { char *p= "ayqm"; char c; c=++*p; printf ("%c" , c); } $a$ $c$ $b$ $q$
What will be the output of the following c-code?void main () { char *p= "ayqm"; char c; c=++*p; printf ("%c" , c); }$a$$c$ $b$$q$
makhdoom ghaya
2.6k
views
makhdoom ghaya
asked
Sep 15, 2016
Programming in C
ugcnetcse-june2010-paper2
programming-in-c
pointers
+
–
2
votes
1
answer
252
c programming
int main() { int i,n; int x = 123456789; void *a = &x; unsigned char *c1 = (unsigned char*)a; for(i=0;i< sizeof a;i++) { printf("%u ",*(c1+i)); } char *c2 = (char*)a; printf("\n %d", *(c2+1)); char *c3 = (char*)a; printf("\n %u \n", *(c3+1)); } Output ?
int main() { int i,n; int x = 123456789; void *a = &x; unsigned char *c1 = (unsigned char*)a; for(i=0;i< sizeof a;i++) { printf("%u ",*(c1+i)); } char *c2 = (char*)a; pri...
dd
847
views
dd
asked
Aug 11, 2016
Programming in C
programming-in-c
output
pointers
+
–
4
votes
2
answers
253
UGC NET CSE | December 2014 | Part 2 | Question: 12
What does the following expression means ? char $∗(∗(∗ a\left[N\right]) ( )) ( )$; A pointer to a function returning array of n pointers to function returning character pointers. A function return ... function returning pointers to characters An array of n pointers to function returning pointers to functions returning pointers to characters.
What does the following expression means ?char $∗(∗(∗ a\left[N\right]) ( )) ( )$;A pointer to a function returning array of n pointers to function returning charact...
makhdoom ghaya
2.9k
views
makhdoom ghaya
asked
Jul 20, 2016
Programming in C
ugcnetcse-dec2014-paper2
programming-in-c
pointers
+
–
4
votes
2
answers
254
Doubt on array of pointers
In C/C++ an array of pointers is same as (A) Pointer to array (B) Pointer to pointer (C) Pointer to function (D) Pointer to structure
In C/C++ an array of pointers is same as(A) Pointer to array(B) Pointer to pointer(C) Pointer to function (D) Pointer to structure
sh!va
1.3k
views
sh!va
asked
Jul 16, 2016
Programming in C
programming-in-c
pointers
array-of-pointers
+
–
7
votes
2
answers
255
ISRO2016-25
What will be output of the following program? Assume that you are running this program in little-endian processor. #include<stdio.h> int main() { short a=320; char *ptr; ptr=(char *)&a; printf("%d",*ptr); return 0; } 1 320 64 Compilation error
What will be output of the following program? Assume that you are running this program in little-endian processor.#include<stdio.h int main() { short a=320; char *ptr; pt...
sourav.
7.6k
views
sourav.
asked
Jul 3, 2016
Programming in C
programming-in-c
pointers
isro2016
little-endian-big-endian
+
–
4
votes
4
answers
256
ISRO2016-20
What is the output of this C code? #include<stdio.h> void main() { int k=5; int *p=&k; int **m=&p; printf("%d %d %d",k,*p,**m); } 5 5 5 5 5 junk 5 junk junk compile time error
What is the output of this C code?#include<stdio.h void main() { int k=5; int *p=&k; int m=&p; printf("%d %d %d",k,*p, m); }5 5 5 5 5 junk5 junk junkcompile time error
sourav.
4.1k
views
sourav.
asked
Jul 3, 2016
Programming in C
programming-in-c
pointers
isro2016
+
–
0
votes
1
answer
257
dangling pointer
operations : (i) Pointer p1 is set to point at a new heap-dynamic variable. (ii) Pointer p2 is assigned p1's value. (iii) The heap dynamic variable pointed to by p1 is explicitly de-allocated, but p2 is not changed by the operation. This situation leads to ... p2 becomes a dangling pointer (C) Both p1 and p2 are now dangling pointers (D) Neither p1 nor p2 is now a dangling pointer
operations :(i) Pointer p1 is set to point at a new heap-dynamic variable.(ii) Pointer p2 is assigned p1’s value.(iii) The heap dynamic variable pointed to by p1 is exp...
Sanjay Sharma
1.7k
views
Sanjay Sharma
asked
Jun 13, 2016
Programming in C
pointers
+
–
0
votes
1
answer
258
Output of Program
main() { char *c , ch[10]; int *i , j[10]; float *f , g[10]; int x; c = ch; i = j; f = g; for ( x=0 ; x<=10 ; x++ ) printf("%p %p %p\n" , c+x , i+x , f+x); }
main(){char *c , ch[10];int *i , j[10];float *f , g[10];int x;c = ch;i = j;f = g;for ( x=0 ; x<=10 ; x++ )printf("%p %p %p\n" , c+x , i+x , f+x);}
shekhar chauhan
361
views
shekhar chauhan
asked
Jun 4, 2016
Programming in C
programming-in-c
output
pointers
+
–
0
votes
1
answer
259
Output of Program ?
#include <stdio.h> int main() { int i = 10; int *const p = &i; fd(&p); printf("%d\n", *p); } void fd(int **p) { int j = 11; *p = &j; printf("%d\n", **p); }
#include <stdio.h int main() { int i = 10; int *const p = &i; fd(&p); printf("%d\n", *p); } void fd(int p) { int j = 11; *p = &j; printf("%d\n", p); }
shekhar chauhan
585
views
shekhar chauhan
asked
Jun 4, 2016
Programming in C
programming-in-c
pointers
+
–
0
votes
1
answer
260
What is output of this Program ? Answer with Explanation .
#include <stdio.h> void fc(float *); int main() { int i = 10, *p = &i; fc(&i); } void fc(float *p) { printf("%f\n", *p); }
#include <stdio.h void fc(float *); int main() { int i = 10, *p = &i; fc(&i); } void fc(float *p) { printf("%f\n", *p); }
shekhar chauhan
471
views
shekhar chauhan
asked
Jun 4, 2016
Unknown Category
programming-in-c
pointers
+
–
0
votes
3
answers
261
lvalue
what is this lvalue error all about . pl explain in simple words
what is this lvalue error all about . pl explain in simple words
Sanjay Sharma
895
views
Sanjay Sharma
asked
Jun 4, 2016
Programming in C
pointers
+
–
0
votes
2
answers
262
Prog \ What is the output of the following program?
#include <stdio.h> int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; // LINE 5 printf("%d %d ", (*ptr)[1], (*ptr)[2]); //LINE 6 ++ptr; printf("%d %d\n", (*ptr)[1], (*ptr)[2]); return 0; } (a) 2 3 5 6 (b) 2 3 4 5 (c) 4 5 0 0 (d) none of the above
#include <stdio.h int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; // LINE 5 printf("%d %d ", (*ptr) , (*ptr) ); //LINE 6 ++ptr; printf("%d %d\n", (*ptr) ...
Desert_Warrior
1.2k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
pointers
+
–
7
votes
1
answer
263
Prog \ What is the output of the following program?
#include <stdio.h> void f(char**); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char **p) { char *t; t = (p += sizeof(int ... \n", t); } (a) ab (b) cd (c) ef (d) gh In GATE Exam, if not specified What should be size of integer?
#include <stdio.h void f(char ); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char p) { char *t; t = (p += sizeof(int)...
Desert_Warrior
1.4k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
pointers
interview
+
–
0
votes
1
answer
264
Prog \ What is the output of the following program??
#include <stdio.h> int main() { struct node { int a; int b; int c; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; printf("%d\n", *((int*)pt+1)); return 0; }
#include <stdio.h int main() { struct node { int a; int b; int c; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; printf("%d\n", *((int*)pt+1)); return 0; }
Desert_Warrior
3.7k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
structure
+
–
0
votes
1
answer
265
Prog\ What is output of the following?
#include <stdio.h> int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; } (a) Compile Error (b) 2 1 (c) 2 5 (d) none of the above
#include <stdio.h int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; }(a) Compile Error (b) 2...
Desert_Warrior
416
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
output
+
–
0
votes
1
answer
266
Prog\ What is the output of the following program?
#include<stdio.h> int a = 10; int main() { fun(); fun(); return 0; } int fun() { static int a = 1; printf("%d ",a); a++; return 0; }
#include<stdio.h int a = 10; int main() { fun(); fun(); return 0; } int fun() { static int a = 1; printf("%d ",a); a++; return 0; }
Desert_Warrior
532
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
output
interview
+
–
0
votes
1
answer
267
Prog \ What is the output of the following program?
#include<stdio.h> #include<stdlib.h> int main() { char s[] = "Opendays2012"; int i = 0; while(*(s++)) i++; printf("%d",i); return 0; } (a) Segmentation Fault (b) Compile Error (c) 12 (d) 0
#include<stdio.h #include<stdlib.h int main() { char s[] = "Opendays2012"; int i = 0; while(*(s++)) i++; printf("%d",i); return 0; }(a) Segmentation Fault (b) Compile Err...
Desert_Warrior
621
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
output
interview
array
+
–
1
votes
1
answer
268
Programming \ What is the output of the following program?
#include<stdio.h> void foo(char *); int main() { char *string = "Hello"; foo(string); printf("%s",string); return 0; } void foo(char *a) { while(*a) { *a += 1; a++; } } (a) Hello (b) Ifmmp (c) Compile Error (d) Segmentation fault
#include<stdio.h void foo(char *); int main() { char *string = "Hello"; foo(string); printf("%s",string); return 0; } void foo(char *a) { while(*a) { *a += 1; a++; } }(a)...
Desert_Warrior
2.1k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
pointers
+
–
0
votes
1
answer
269
Programming \ What is the output of the following program?
#include <stdio.h> int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; } options are : (a) Compile Error (b) 2 1 (c) 2 5 (d) none of the above
#include <stdio.h int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; }options are : (a) Compi...
Desert_Warrior
421
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
pointers
+
–
0
votes
1
answer
270
Prog \ What is the output of this program?
#include<stdio.h> int main() { int a[10][20][30] = {0}; int *b = a; int *c = a+1; printf("%ld", c-b); return 0; }
#include<stdio.h int main() { int a[10][20][30] = {0}; int *b = a; int *c = a+1; printf("%ld", c-b); return 0; }
Desert_Warrior
804
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
+
–
Page:
« prev
1
...
4
5
6
7
8
9
10
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register