Home Answers Viewqa IoC C Concepts

 
 


Srinivasan
C Concepts
1 Answer(s)      2 years ago
Posted in : IoC

respected sir, Can I use a void ** pointer as a parameter so that a function can accept a generic pointer by reference?

I have a function

    extern int f(int *);

which accepts a pointer to an int.  How can I pass a constant by
reference?  A call like

    f(&5);

doesn't seem to work.

View Answers

June 14, 2011 at 5:16 PM


hi, Srinivasan

In C language you could not write a function which returned generic pointers indirectly via a hypothetical void * pointer because it is not a generic pointer to pointer. You could not passed a void *, but rather a double ** when you will tried to use it for declaring and calling :

double *dptr;
    void *vptr = dptr;
    func(&vptr);
    dptr = vptr;

If the void ** pointer pointed to and is not a void *, and the size and representation of void * is different, then the compiler will unable to access it correctly.

It can not be done directly, for doing this you have to declare a variable temporarily and then the address of it passed to the function

int a = 5;
    f(&a);









Related Pages:
C Concepts
C Concepts  respected sir, Can I use a void ** pointer as a parameter so that a function can accept a generic pointer by reference? I have a function extern int f(int *); which accepts a pointer to an int. How can I pass
C++ - Design concepts & design patterns
C++  class xClass { public: void func(); void print(); xClass... function print that prints the vii. Write a C++ statement that prints the values of the data members of the object x. viii. Write a C++ statement
c programming - Design concepts & design patterns
c programming  Q.1- Write a program in 'c' language to merge the contents of two binary search trees into one. Also, calculate the time and space complexities of your program? Q.2- Write a C++ program to create functions
C Language - Design concepts & design patterns
C Language  What is meant by %u in printf statement in c? for example,%d means integer value,like that what is %u?  Hi Friend, %u is used to print an unsigned integer. Unsigned integers are non-negative numbers
C++Tutorials
from its basics up to the newest features of ANSI-C++, including basic concepts... C++ Tutorials              C++ Tutorial
java - Design concepts & design patterns
in Physics>=50 (c) Marks in Chemistry >=40 (d) Total in all three...){ System.out.println("Eligible."); try{ File file = new File("C:\\selectedCandidate.txt
urgentt - Design concepts & design patterns
as a,b,c,d,e,f.six group.60/10=6.For the first 10 studets lot no should be generated
urgentt - Design concepts & design patterns
as a,b,c,d,e,f.six group.60/10=6.For the first 10 studets lot no should be generated
C++
C++  How can i write this in dev c
C++
C++  How can i write this in dev c
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
c++
c++  write a programme that calculates the area and circumference of a rectangle
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
C++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C and C++ books-page12
like Pascal or C which use object-oriented concepts. But there exist a few... C and C++ books-page12       Introduction to C programming  This section is designed
C++
C++  Describe the principle advantages of deploying a linked list versus a static array when implementing a Queue or a Stack
c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values
C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me
C#
C#  i need a code that will make program perform the basic operations upon the data Listview save, update and cancel
c++
c++  write a program that gets a key or character from the keyboard and displays it ASII code in decimal, hexadecimal and binary form.It must also give a description of the key pressed
c++
c++  write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area
C++
C++  write a prgrm tht gets five values,gets the sum,average &...; #include <conio.h> void main() { clrscr(); int a,b,c,d,e,sum; float average...;>b>>c>>d>>e; sum=a+b+c+d+e; average=sum/5; product=a*b*c*d
c++
c++  .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  Consider the following function: int funcExercise7(int list[], int size) { int sum = 0; for (int index = 0; index < size; index++) sum = sum + list[index]; return sum
c++
c++  Consider the following declarations: class xClass { public: void... private members does class xClass have? c. How many constructors does class xClass.... Write a C++ statement that prints the values of the data members of the object
C#
C# register form  i want to generate a user id automatically after filling their register form and i want to show their id to their email? please reply me soon
c++
c++  Consider the following declarations: class xClass { public: void func(); void print() const; xClass (); xClass (int, double); private: int u... private members does class xClass have? c. How many constructors does class xClass
c++
c++  Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo... name with the minimum GPA 7) Display Student GPAs as Letter Grades (A, B, C, D
TOMCAT INSTALLATION ERROR - Design concepts & design patterns
TOMCAT INSTALLATION ERROR  I HAD INSTALL APACHE TOMCAT 5.5...ALSO SET ENVIRNOMENT VARIABLE i.e C:\Program Files\Java\jdk1.6.0_14 and CLASSPATH C:\apache-tomcat-5.5.28\common\lib\servlet-api.jar.. WHILE RUNNING http://localhost
c++
c++  Characterize the following algorithm in terms of Big-O notation. for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 1; k <= n; k++) cout << i + j + k
C++
C++  . Consider the definition of the following class: class CC { public: CC(); //Line 1 CC(int); //Line 2 CC(int, int); //Line 3 CC(double, int); //Line 4 . . . private: int u; double v
c++
c++  .write a prgrm tht accepts 5 subjects of a student,it shld hv a function to calculate the average & another function to grade.grade shld be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  Characterize the following algorithm in terms of Big-O notation. Also find the exact number of additions executed by the loop. (Assume that all variables are properly declared.) for (int i = 1; i <= n; i++) sum = sum + i
c++
c++  Write the definition of the class dayType that implements the day of the week in a program. The class dayType should store the day... on an object of type dayType: a. Set the day. b. Print the day. c. Return the day
c++
c++   Assume vector "x" of integers with values of 7, 3, 5, 8, 1, 9, 0, 4, 2, 6. Second, assume integer variables "a," "b" and "y" with values of 3, x.size()-5 and 0, respectively. Third, assume a for-loop header which: 3.1
c++
c++  write a programme that calculates the area and circumference of a rectangle   #include<conio.h> #include<iostream.h> class rect { int l,b; int area; int peri; public: void get_rect() { cout<<"\n
Objective C
concepts.   Objective C Introduction This section provides... Objective C       Objective C is a programming language, which is sleeted by Apple for developing
Entity relationship model - Design concepts & design patterns
is an acceptable value, and, if acceptable, what null indicates. c. If you think... choice answers (A, B, C, D) to the questions and information about each
C and C++ books-page1
and the concepts involved with programming C++. You'll find the numerous examples of syntax... C and C++ books-page1       The C Books This is the online version of The C Book, second
Objective C Tutorial
Tutorial This tutorial will help you learn the core concepts of objective c... Understanding the Objective C OOPs concepts Memory management in Objective C... with the Objective C core concepts. In the next few sections we will be: Setting
javascript,jsp - Design concepts & design patterns
them as a,b,c,d,e,f.six group.60/10=6.For the first 10 studets lot no should
Javascript random number - Design concepts & design patterns
another.If there is 60 stuednts.Group them as a,b,c,d,e,f.six group.60/10=6.For
jaavscript & ajax - Design concepts & design patterns
)).getBytes()).length; saveFile="C:/UploadedFiles/"+saveFile; File ff = new
C,C++
C,C++  Sir, 100&30 gives output 4 in C++ and 100|30 gives output 116 How & and | gives output 4 and 116
Hibernate concepts
Hibernate concepts  hibernate concepts Entity System,Entity Named Resolver,Auxiliary database objects,ternary associations and interceptors are used in real -time programming