C++ :: Define Statement Assigning Addresses

Sep 10, 2013

I dont understand the pointers or the parenthesis.

#define PORTA *(unsigned char volatile *)(0x0000)

View 2 Replies


ADVERTISEMENT

C :: Check Addresses On Equality Possible?

Sep 18, 2014

I was wondering if it is possible to check if two addresses, so pointers are equal.I was saving the address of an array, and later wanted to identify it by the address, so if my area has the address: int *my_array; // is equal to: 0x1e9aa3a2c ...Later when I go through a list of pointers like:

list=
0x1e9c7e060
0x1e9ba6640
0x1e9aa3a2c <== my address
0x1e9aa3a2c

I want the third one to be equal to my list, but with == it didn't work for me.

View 3 Replies View Related

C# :: Looping Through A Range Of IP Addresses

Feb 6, 2014

I want to take a starting IP on a local network, and loop through to an ending IP on a local network, pinging all the IP addresses in between. For instance, ping all IP addresses between 192.168.1.1 - 192.168.1.255 (user enters desired starting IP and ending IP in text boxes).

I have the ping functionality working, and i can make it all work with lots of messy string parsing.. but it seems sloppy to me.

I have to split the strings (start and end IP) to get the last octet, then subtract to get the range of IPs. Then loop through, adding 1 to the last octet, and converting back to a string each time.

The C# Ping class can use either a string or an IPaddress for its Send method. If I use IPAddress, I just have to convert it from the text box it originates in, but the adding 1 to the last octet in the loop is a hassle.

Anyway, I guess the only question I have is, if you had to loop through a range of IP addresses, how would YOU do it?

public Job(string ipStartIn, string ipEndIn) {
long ip1 = Convert.ToInt64(ipStartIn);
long ip2 = Convert.ToInt64(ipEndIn);
IPStart = new IPAddress(ip1);
IPEnd = new IPAddress (ip2);
this.deviceAlive = false;

[Code] ....

View 14 Replies View Related

C/C++ :: Hashing Hexadecimal Addresses?

Feb 25, 2015

I'm taking a university course and one of our first projects dealing with C is to write a hash table (with chaining as a collision solution) that will hash loads of hexadecimal values into the table. I'm just brain storming right now but how practical is it to hash the values by converting them to decimal and working with that value in another function to organize the values? I'm thinking this might take a lot of time and memory because our code will be tested with text files that could have a few lines of hexadecimal addresses or millions of them.

View 2 Replies View Related

C++ :: Compare Memory Addresses On The Stack?

Dec 4, 2014

Jumping into C++, question 5 page 181:

"Write a program that compares the memory addresses of two different variables on the stack and prints out the order of the variables by numerical order of their addresses.

Does my solution look correct

Code:
#include <iostream>
using namespace std;
int main() {
int one = 1;
int two = 2;
if (&one < &two)
cout << one << " " << &one << " " << two << &two << endl;
else
cout << two << " " << &two << " " << one << " " << &one << endl;
}

View 6 Replies View Related

C :: Can Get Memory Addresses From Compile Time?

Sep 1, 2013

My question is this: Is it possible to determine where functions are stored at compile time, so that at run time you can pass the memory address as a pointer to the interrupt handler so that it can directly call the function at memory location 'X'?

The newest project I'm working on would require to either somehow capture these addresses or to find a work-around so that instead of passing the pointer to the interrupt handler, the software would then need to be able to be non-interruptable.

View 2 Replies View Related

C++ :: Memory Addresses Of Pointers To Structs

Apr 19, 2014

I have this struct declaration to create a linked list

struct node {
string y;
node* next;
};

If I create a linked list of 3 nodes

A->B->C->NULL

A->y is "a"
B->y is "b"
C->y is "c"

Since they are consecutive in memory. How far apart are the strings in memory?

I tried doing something like

int n = &(head->next->x)-&(head->x);

The problem is that I got 6 while debugging and 2 otherwise.

View 1 Replies View Related

C/C++ :: Passing Structure Addresses To Functions

Mar 20, 2014

What this is, is a more recent assignment and my question is if my errors are directly related to passing structure addresses to functions. I've tried several syntax variations at the beginning of my loops such as this one:

while (choice != "Q" || "q")

But the loops will not run since I introduce polar to rectangular and the choice element. My last working code was rectangular to polar and all of it worked fine.

#include<iostream>
#include<cmath>
using namespace std;
//structure declarations
struct polar
{
double distance; //distance from origin
double angle; //direction from origin

[Code] ....

View 14 Replies View Related

C++ :: Initializing Pointers To Memory Addresses Or Values?

Aug 31, 2014

What is the difference between initializing pointers to a memory address using the address operator like int *pointer = &x; or initializing it to a value like int *pointer = x; .. in other words how does p and q point to the same memory address in:

const int ARRAY_LEN = 100;
int arr [ ARRAY_LEN ];
int *p = arr;
int *q = &arr[0];

View 4 Replies View Related

C++ :: Way To Use Debugger To Log Addresses Of Data It Allocated On Heap

Sep 19, 2014

I used a heap viewer to check for memory leaks. I have many of them and its hard to find out where it is not being freed. Is their a way to use the debugger to log the addresses of the data it allocated on the heap. This way I can trace it back. Or is their any other way to fix memory leaks properly.

View 4 Replies View Related

C :: Save Data To Arrays Defined In Main Using Their Addresses

Dec 30, 2013

so i have two classes ( main and another one ask ) in main i have defined 3 arrays (char drivers[250] ,offences[250] , owners[250]) and also included their pointers ( char *drivers_ptr,*offences_ptr,8owners_ptr)my problem is that i need to set values (actually 1 string of 250 chars to each of these arrays BUT from the class ask without making these arrays global -as this is prohibited by my university exercise !- )

so my question is how will i manage to save data to the arrays that i have defined in main using their addresses(through the pointers of each one that i have passed to the ask class) from the ask class ?

View 4 Replies View Related

Visual C++ :: TCP/IP Program - Display All IP Addresses That Are Connected To Client

Mar 12, 2013

I need to create a TCP/IP program using visual studios MFC that displays all client's IP addresses that are connected to the client.

The MFC application just has a list box and a button. The client can be a simple console application. When the button is clicked, the list box gets populated with all ip addresses of connected clients.

View 14 Replies View Related

C++ :: Program That Prints Out Memory Addresses Of Each Element In Two Dimensional Array

Jun 21, 2013

the question is; Write a program that prints out the memory addresses of each element in a two-dimensional array. Check to see if the values printed out make sense to you based on the way I explained it before.

Below is the code I have done. I am having problems printing the "-" sign to keep formatting with the board when the user enter in different dimensions other than [4][4].

Code:

#include <iostream>
using namespace std;
void printTable (int x, int y) {
int **p_p_twoDimension = new int* [y];
for (int i = 0; i < y; i++) {
p_p_twoDimension[i] = new int [x];}

[Code]...

View 12 Replies View Related

C++ :: Iterate Through Char Array And Pull IP Addresses To Test If They Respond

Apr 8, 2013

I am trying to write a loop that will iterate through a char array in C and pull the IP addresses and test them to see if they respond. My ultimate goal is to have the first one that responds returned in the function, but the loop is not running correctly. It will run through right the first time, but then will start over again.

Code:
const char * getServer(char *svrList) {
char *srList;
srList = strtok(svrList, " ," );
printf("Contents of srList b4 loop: %s
", srList);
printf("Server List: %s
", svrList);

[Code] ....

Code output:
Contents of srList b4 loop: 1.1.1.1
Server List: 1.1.1.1
result is "1.1.1.1"
Hitting else loop
Contents of srList in else: 2.2.2.2
result is "2.2.2.2"
result is "2.2.2.2"
Contents of srList b4 loop: 1.1.1.1
Server List: 1.1.1.1
result is "1.1.1.1"
Hitting else loop
Contents of srList in else: (null)

View 14 Replies View Related

C++ :: Transfer If-else Statement Into Switch Statement?

Sep 7, 2013

How to make if else code below into SWITCH STATEMENT?

cout << "Enter the temperature: ";
cin >> temp;
cout << "Enter the pressure: ";
cin >> pressure;
cout <<endl;

[Code]....

View 6 Replies View Related

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 View Related

C :: Possible To Define Arrays

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

C++ :: Define Variable That Is In HEX Value

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

C++ :: Assigning Bits A Value Of 0

Feb 12, 2014

I am having a problem assigning bits a value of 0. The data is a 16 bit integer the bits greater than the 12th bit have garbage either a 0 or a 1. I would like to assign all bits greater than 12th bit the value 0 no matter what their values are. Whats the best approach.

View 5 Replies View Related

C :: How To Define The Lock Detect

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

C :: How To Define Negative Number

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

C++ :: Define A Vector In A Class?

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

C++ :: How To Define A Class Which Have Two Members

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

C++ :: Define A Class For A Type

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

C++ :: Using Structs To Define A Function

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

C++ :: Define Long Variable And XOR

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







Copyrights 2005-15 www.BigResource.com, All rights reserved