Awesome q2a theme
0 votes
36 views

in Programming by (257 points) | 36 views
0

https://csedoubts.gateoverflow.in/9139/pointer-assignment

same concept. It would generate 1006 as output.

1 Answer

+1 vote
Best answer
let suppose   $int$ $a = 5$  and size of int is $4B$ and add of a is 1000 then
$a+1$ then it will be $6$.
$&a+1 $ means address of $a$ +  size of $a$ $= 1000+4 = 1004$
--------------

Come to Question , here $s$ is an array and size of $s$ is $6B$.
$&s+1$ $= 1000+6$
$int$ $*str = $$(int $ $*)1006$ //Array pointer is typecasted to integer pointer.

Now $str$ contain 1006.

It will print $1006$.

let me know if i missed something.
by (64 points)
selected by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users 2020 Aug 10 - 16
  1. jayeshasawa001

    85 Points

  2. Arkaprava

    44 Points

  3. Nilabja Sarkar

    12 Points

  4. Ashutosh777

    9 Points

  5. premu

    8 Points

  6. abcd9982

    5 Points

  7. siddharths067

    4 Points

  8. iarnav

    4 Points

  9. 404 found

    3 Points

  10. shashankrustagi2021

    2 Points

Weekly Top User (excluding moderators) will get free access to GATE Overflow Test Series for GATE 2021
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Aug 2020
  1. Mellophi

    152 Points

  2. jayeshasawa001

    90 Points

  3. Ashutosh777

    85 Points

  4. anurag sharma

    49 Points

  5. Arkaprava

    44 Points

  6. Kushagra गुप्ता

    15 Points

  7. premu

    14 Points

  8. Shaik Masthan

    13 Points

  9. srestha

    13 Points

  10. shashankrustagi2021

    12 Points

7,750 questions
1,853 answers
11,219 comments
95,104 users