473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pointer Interpretation

I am a C newbie. While trying to reverse engineer a program, I got the following code:

*lastBank++ = (*(((const real_T**)ssGetInputPortSignalPtrs(S, 0))[0]));

Can somebody tell me what it means in plain English. Especially the double pointer
const real_T**.

Thanks

Umesh
Feb 22 '07 #1
3 1730
r035198x
13,262 8TB
I am a C newbie. While trying to reverse engineer a program, I got the following code:

*lastBank++ = (*(((const real_T**)ssGetInputPortSignalPtrs(S, 0))[0]));

Can somebody tell me what it means in plain English. Especially the double pointer
const real_T**.

Thanks

Umesh
Have you read a tutorial on pointers? What do you think it means?
Feb 22 '07 #2
DeMan
1,806 1GB
Hiya,

Pointers are one of the most confusing aspects of c for people new to the idea.
I think the biggest mistake most people make when they first encounter pointers is that they assume * (asterisk) means pointer. Get that idea out of your head. Think of * as "The value at" and make a habit of declaring pointers by prefixing the asterisk, and postfixing something that makes you think 'pointer'.
eg:
UINT8 *my_ptr

Then you can translate this as "I want the value at my_ptr to be an unsigned int". Furthermore, when you refer to my_ptr, you are referring to the pointer, and any time you want to talk about the value you need to say *my_ptr (the value AT my pointer).
The biggest trouble most people I know encountered (and certainly the biggest problem I had) in coming to understand pointers) was that when you think of the asterisk declaring the pointer, you start to think that things starting with the asterisk must be pointers.
In actual fact, once declared, the variable ITSELF is the pointer, and once you introduce the asterisk you are looking for the value at that memory address. (and for something that I thought would be easy to explain, I'm starting to confuse myself).

In short, try to remember that * means value at (we won't get into the ampersand &).

In plain English, then:

*lastBank++ = (*(((const real_T**)ssGetInputPortSignalPtrs(S, 0))[0]));

could tranlate (roughly) to:

set the value one past lastBank to be the value you get (when you think of it as a pointer to a pointer to an unchangeable structure called real_T)if you take the value 0 positions past the result given to you by the method ssGetInputPortSignalPtrs when given inputs S and 0.
Feb 22 '07 #3
r035198x
13,262 8TB
Hiya,

Pointers are one of the most confusing aspects of c for people new to the idea.
I think the biggest mistake most people make when they first encounter pointers is that they assume * (asterisk) means pointer. Get that idea out of your head. Think of * as "The value at" and make a habit of declaring pointers by prefixing the asterisk, and postfixing something that makes you think 'pointer'.
eg:
UINT8 *my_ptr

Then you can translate this as "I want the value at my_ptr to be an unsigned int". Furthermore, when you refer to my_ptr, you are referring to the pointer, and any time you want to talk about the value you need to say *my_ptr (the value AT my pointer).
The biggest trouble most people I know encountered (and certainly the biggest problem I had) in coming to understand pointers) was that when you think of the asterisk declaring the pointer, you start to think that things starting with the asterisk must be pointers.
In actual fact, once declared, the variable ITSELF is the pointer, and once you introduce the asterisk you are looking for the value at that memory address. (and for something that I thought would be easy to explain, I'm starting to confuse myself).

In short, try to remember that * means value at (we won't get into the ampersand &).

In plain English, then:

*lastBank++ = (*(((const real_T**)ssGetInputPortSignalPtrs(S, 0))[0]));

could tranlate (roughly) to:

set the value one past lastBank to be the value you get (when you think of it as a pointer to a pointer to an unchangeable structure called real_T)if you take the value 0 positions past the result given to you by the method ssGetInputPortSignalPtrs when given inputs S and 0.
Spoilsport .
Feb 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: Ike Naar | last post by:
In K&R "The C++ programming language (2nd ANSI C edition), the reference manual states (paragraphs 7.9 and 7.10) that pointer comparison is undefined for pointers that do not point to the same...
10
by: j0mbolar | last post by:
for any pointer to T, does a pointer to T have different or can have different alignment requirement than a pointer to pointer to T? if so, where is the exact wording in the standard that would...
204
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 =...
41
by: Alexei A. Frounze | last post by:
Seems like, to make sure that a pointer doesn't point to an object/function, NULL (or simply 0) is good enough for both kind of pointers, data pointers and function pointers as per 6.3.2.3: 3 An...
5
by: max | last post by:
Dear all, I did the following analysis to conclude that the following pointer types are not compatible. Please let me know If my analysis and interpretation of the C standard are correct: ...
51
by: Kuku | last post by:
What is the difference between a reference and a pointer?
4
by: Bernd Gaertner | last post by:
Dear experts, according to my interpretation of the Standard, loop 1 in the following program is legal, while loop 2 is not (see explanation below). This looks a bit counterintuitive, though; do...
19
by: =?iso-8859-1?b?VG9t4XMg0yBoyWlsaWRoZQ==?= | last post by:
Coming originally from C++, I used to do the likes of the following, using a pointer in a conditional: void Func(int *p) { if (p) { *p++ = 7; *p++ = 8;
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
50
by: arunajob | last post by:
Hi all, If I have a piece of code something like this void main(void) { char * p1="abcdefghijklmn"; ............................................. }
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.