Solved

How to pass a value between two cpp file and a main.cpp by pointers?

Posted on 2007-04-03
6
362 Views
Last Modified: 2013-11-20
How to pass a value between two cpp file and a main.cpp by pointers?
0
Comment
Question by:9Tails
  • 2
6 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 18847672
Well, you haven't given us a lot here.  I take it you're trying to call functions in the other files with pointer parameters?

//File1.h
void Fun1(void * Param);

//File2.h
void Fun1(void * Param);

//File1.cpp
#include "File1.h"
void Fun1(void * Param){
  //Do something here with the parameter
}


//File2.cpp
#include "File2.h"
void Fun2(void * Param){
  //Do something here with the parameter
}

//Main.cpp
#include "File1.h"
#include "File2.h"
int main(){
  int *p_I;
  int j;
  char p_C[100];

  //do something

  Fun1(p_C);

  Fun2(p_I);

  Fun2(&j);
}
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 18848921
Does DanielWilson's reply answer your question, or are you looking for something else ?
0
 
LVL 4

Expert Comment

by:havman56
ID: 18851020
use extern variable name .   or have global pointer use it across
0
 
LVL 4

Expert Comment

by:havman56
ID: 19203758
i feel point split should be done
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 152
Why is "packages element is not declared"? 2 324
Where did System.Data.Objects go? 2 40
FMX TEdit KeyUp handler detecting  "enter" key 4 13
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question