Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I have a function which accepts a pointer to an int. How
can I pass a constant like 5 to it?

Answers were Sorted based on User's Feedback



I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?..

Answer / guest

You will have to declare a temporary variable.

Is This Answer Correct ?    0 Yes 0 No

I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?..

Answer / om prakash mishra

u have to take a temporary variable and pass its adress to
the pointer...like that given below:

// assuming all the conditions are given


int temp=5;
function(&temp);

Is This Answer Correct ?    0 Yes 0 No

I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?..

Answer / jaya prakash

Only Using type modifiers only constant 5 is sent to
function.

[In previous 2 answers address of variable temp (5) is only
send to fn , not a constant 5]

for that fn-call is

function((int*)5);

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.

0 Answers  


How arrays can be passed to a user defined function

0 Answers  


What happens if a header file is included twice?

0 Answers  


How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

2 Answers   CMC, Wipro,


If you know then define #pragma?

0 Answers  


Write a c pgm for leap year

11 Answers   College School Exams Tests, IBM, TCS,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }

3 Answers  


What is chain pointer in c?

0 Answers  


c pgm count no of lines , blanks, tabs in a para(File concept)

2 Answers  


explain memory layout of a C program

2 Answers  


What is difference between Structure and Unions?

0 Answers   TISL,


In which area global, external variables are stored?

3 Answers  


Categories