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

How can I make it pause before closing the program output window?

0 Answers  


#include<stdio.h> int main( ) { Int a=300, b, c; if(a>=400) b=300; c=200; printf(“%d%d ”, b, c); return0; }

1 Answers  


sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which digits are entered by user?

2 Answers  


can v write main() { main(); } Is it true?

6 Answers  


There are 3 baskets of fruits with worng lables,one basket has apple,another basket has orange,another has combination of apple and orange,what is the least way of interchange the lables.

15 Answers   Cisco, Google, MBT,






main() { char *ptr = "Ramco Systems"; (*ptr)++; printf("%s\n",ptr); ptr++; printf("%s\n",ptr); } Find the Outputs?

9 Answers   BTBP, CitiGroup,


What is the right type to use for boolean values in c? Is there a standard type?

0 Answers  


how to find the largest element of array without using relational operater?

6 Answers   Satyam, Wipro,


Why C language is a procedural language?

0 Answers   Ericsson,


prog for 1st five prime numbers in 2^x - 1

0 Answers  


can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance

1 Answers   IBM,


what is void pointer?

1 Answers   Wipro,


Categories