C :: Pointing To Define To Get Value
Jul 24, 2013
I am trying to understand how to get the following value from a define. The code i am trying to understand is as follows:
Code:
#define RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET {0xF000}
Code:
#define RADIO_CONFIGURATION_DATA {
Radio_Configuration_Data_Array,
RADIO_CONFIGURATION_DATA_CHANNEL_NUMBER,
RADIO_CONFIGURATION_DATA_RADIO_PACKET_LENGTH,
RADIO_CONFIGURATION_DATA_RADIO_STATE_AFTER_POWER_UP,
RADIO_CONFIGURATION_DATA_RADIO_DELAY_CNT_AFTER_RESET,
RADIO_CONFIGURATION_DATA_CUSTOM_PAYLOAD
}
and also have this
Code:
typedef struct {
U8 *Radio_ConfigurationArray;
U8 Radio_ChannelNumber;
U8 Radio_PacketLength;
U8 Radio_State_After_Power_Up;
U16 Radio_Delay_Cnt_After_Reset;
U8 Radio_CustomPayload[RADIO_MAX_PACKET_LENGTH];
}
tRadioConfiguration;
so then in the api i have the following
Code:
for (; wDelay < pRadioConfiguration->Radio_Delay_Cnt_After_Reset; wDelay++); .
so my question is how do i declare my variables, correct terminology ?, to achieve this.
View 7 Replies
ADVERTISEMENT
Apr 13, 2014
Is:
char *endp = NULL;
the same thing as:
char *endp = 0;
?
View 1 Replies
View Related
Dec 9, 2013
in the below program for both class pointers pointing to null. Class contains normal function executing but class contains virtual function getting segmentation fault.
#include <cstdio>
using namespace std;
class A
{
[Code].....
View 1 Replies
View Related
Feb 4, 2014
I have 22 CButtons and I'm trying to set each one to the corresponding position in a CButton array of size 22 in the constructor.
Code:
*buttons[0] = m_button1;
This code gives me an error in the compiler.
error C2248: 'CObject:perator =' : cannot access private member declared in class 'CObject'
View 2 Replies
View Related
Feb 8, 2015
Cam is a pointer to a structure and viewpoint is a vector located within the struct. I am trying to read in from a file the coordinates for the vector. I have also tried &cam->view_point->x as well as &cam.view_point.x and it tells me that I am requesting something not in a struct
Code: count= fscanf(in,"%d %d %d", &cam->view_point.x, &cam->view_point.y,&cam->view_point.z);
View 14 Replies
View Related
Apr 13, 2012
In C++, how do i call a method member of class A from a class B, using a pointer. By the way Class A and B are of different types.
I read that when a pointer is pointing to member function it can only point member functions within the class. But how can i point to a member function outside the class.?????
for example
class A {
public:
int add(int x) {
return x+x;
[Code] .....
View 1 Replies
View Related
Apr 12, 2013
[URL] ....
Which object's draw is being called?
View 6 Replies
View Related
May 3, 2013
At the moment im trying out with pointing to an array of functions. I got this working as following:
typedef void (* functionPtr) ();
functionPtr functions[2][2]={{do11,do12}, {do21,do22}};
void do11(){DEBUG_PRINTLN("11");}
void do12(){DEBUG_PRINTLN("12");}
void do21(){DEBUG_PRINTLN("21");}
void do22(){DEBUG_PRINTLN("22");}
void loop(){
A=0;
B=1;
functions[A][b]();
}
But now I'm trying to use this to point to a function inside a class so instead of do11, i want to be able to point to Basic.Do11. Somehow this doesnt work and I keep on getting this message:
error: argument of type 'void (Basic::)()' does not match 'void (*)()'
View 2 Replies
View Related
Mar 17, 2013
how I can create a structure that pointing to another different structure. And also passing structure to function.
View 3 Replies
View Related
Mar 6, 2015
I have one small doubt in arrays. Is it possible to define arrays like this a[b[10]] ?...
View 6 Replies
View Related
Aug 31, 2013
I want to define variable that is in HEX value & has 64 bits.but I dont know what I can use.....I use unsigned long long but it doesn't useful.
View 2 Replies
View Related
Feb 24, 2013
It is my first time in use lock detect so i didn't now how to start.
how to define the lock detect?
View 4 Replies
View Related
Sep 3, 2014
I nead to define an a negative number a normal posetive number i defined like #define RSSI_UP 1 can i write #define RSSI_DOWN -1???
View 2 Replies
View Related
Aug 9, 2013
First this is my code:
#include <iostream>
#include <vector>
#include <cstdlib>
[Code].....
the blacked content got problems: the error messages are the throat_t::P or throat_t::T is inaccessible.
View 3 Replies
View Related
Sep 16, 2013
I want to define a class, which will have two members, for example, vaporPressureStatus and vaporPressure
enum vpStatus_t {nonesense, unknown, known, saturated};
class pore_t {
public:
vpStatus_t vpStatus;
double vaporPressure;
};
when vpStatus is nonsense and unknown, the vaporPressure should not have a value; and if I calculate out a value for vaporPressure, the vpStatus can be set as known.
I am wondering if there is any set, pair or other structure can hold this two members together, so that when I change one's value, the other guy will also change accordingly.
View 3 Replies
View Related
Apr 29, 2014
Define a class for a type called CounterType. An object of this type is used to count things, so it records a count that is a non-negative whole number.
Include a mutator function that sets the counter to a count given as an argument. Include member functions to increase the count by one and to decrease the count by one. Be sure that no member function allows the value of the counter to become negative.Also, include a member function that returns the current count value and one that outputs the count. Embed your class definition in a test program and run sufficient tests to verify it all works correctly.
View 1 Replies
View Related
Sep 27, 2013
What I'm trying to do :
struct foo {int x; int y;};
foo function_example(int x, int y) {
foo temp;
temp.x = x;
temp.y = y;
return temp;
}
Works as is, however when I try doing it through seperate class files :
//header file for class example_class
struct foo {int x; int y;};
foo function_example(int x, int y);
//source file for example_class
foo example_class::function_example(int x, int y) {
foo temp;
temp.x = x;
temp.y = y;
return temp;
}
I get an error telling me that foo is undefined, and that declaration of function_example(int x, int y) is incompatible with the declaration of it in the header file.
View 1 Replies
View Related
Aug 15, 2013
I want to write encryption algorithm.first af all I need to define variable( binary input ) that it is 256 bit but I dont know what should I use...then I want to XOR this to variable ( a & b ) ( each of them is 256 bit)
View 6 Replies
View Related
Jan 16, 2013
I have written code for a timer. with everything and i want to include this so i dont need to write or copy the reqd code each time. how do i do this?
View 9 Replies
View Related
Apr 15, 2015
If I’m trying to define an optional one to many relationship I need to reference the primary key of the table
e.g
modelBuilder.Entity<TCC_ArchivedIntegrationExceptions>()
.HasRequired(t => t.TCC_TransactionHistory)
.WithOptional(t => t.TCC_ArchivedIntegrationExceptions);
Where TCC_ArchivedIntegrationException is the optional key.. but those models are inheriting their key from a base entity
So do I have to create the key explicitly in the model or is there another way around this?
View 1 Replies
View Related
Oct 7, 2014
When are you creating fields/properties for specific classes and when you are not doing it but creating them inside just lets say straightaway inside some methods within that classes. I mean if i got class where inside i want to create instance of some other class and then pass this instance to another class - should i create a field for it within class i am doing this operation or not? I was always reading that you create field/properties when its belong to class itself. So if i want only to create some instance outside class i am working and pass it to other class and this is not exactly the part of this class shouldnt i create a field for it and just create it inside method?
View 5 Replies
View Related
May 15, 2014
I want a speed of O(1) in search, insertion and deletion.
is std::map<> the way to go?
View 4 Replies
View Related
Jul 14, 2014
In C++ there are a number of primitives that are not defined in terms of other types. By this I'm thinking
int a = 1;
char b = 'M';
float c = 3.45f;
short d = 0xC3A3;
Is it possible to define your own literal? What I would like to do is have a hex literal for a data type where n = sizeof(data_type). If this type were a big integer, then I would want something like:
BigInt e = 0x13CA9B0C98D983E912DA0B0A9F87E0;
My goal is to assign a value from one contingous chunk of bytes and to not do it with a string.
View 1 Replies
View Related
Sep 17, 2013
I just compiled some code I've been working on at a different OS/compiler and realised that Code: sizeof(unsigned long) returns 4 in one pc and 8 in another.
I've heard that bytesize conventions for basic variables were not particularly "universal" before but this is the 1st time I've had a problem with it.
how do I make a typedef that clearly indicates to whatever compiler compiler I want u32 to be an 32bits unsigned and u64 to be 64bits?
View 12 Replies
View Related
Jan 18, 2015
How can I define type MARKS which will be able to hold 4 elements just like array? I want to access it just like normal array elements using brackets []. In the following struct I want to use such type.
Code:
typedef struct {
MARKS ** pointers;
} ARGUMENTS
void main(){
ARGUMENTS arguments;
[Code] ......
Purpose of the struct ARGUMENTS is to hold 4 pointers to string. I want to mark few positions in string so I can simple access them. E.g. name=John
Code:
arguments[0][0]=0; // begin of the param name
arguments[0][1]=3; // end of the param name
arguments[0][2]=5; // begin of the value
arguments[0][3]=8; // end of the value I mean not to save int but the pointer to the corresponding position.
View 8 Replies
View Related
Jan 20, 2013
I am trying to run a simulation with a large number of objects (mainly arrays and vectors). I am not sure where shall I define my objects: inside or outside of the main() function, like the following two structures:
(1) ---------------
//main.cpp
int main(){
array<double, 1000> a_1 = {};
array<double, 1000> a_2 = {};
......
func_1(a_1, a_2, ..., a_100);
return 0;
}
[Code]...
I know there is a question about scope. But besides this question (which seems have no difference between these two structures here), is there any difference in terms of execution performance or security issue?
View 3 Replies
View Related