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

What are structural members?

0 Answers  


please help me.. how to write a code of this output?? "Enter range number:"10 1 is an odd number 2 is an even numbers 3 in an odd numbers 4 " to 10" "printing all odd numbers:" 1,3,5,7,9 "printing all even numbers:" 2,4,6,8,10 "sum of all odd numbers:25 "sum of all even numbers:30 using a C Programming ARRAY pleas pleas help.. its my project ..please :(

1 Answers  


What is a header file?

0 Answers  


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

0 Answers  


what is an inline function?

2 Answers   TCS,






I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...

0 Answers  


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

0 Answers   ADP,


what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,tracker: for(tracker=0;tracker<=a;tracker++) sum+=tracker; printf(ā€œ %d\nā€,sum); } what is the difference between a=10 and a=010??

3 Answers   Oracle,


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

0 Answers  


what is Structural oriented language? give some example of this language.....?

1 Answers  


i have a written test for microland please give me test pattern

0 Answers   Microland,


What is difference between scanf and gets?

0 Answers  


Categories