Programming :: Is Spacing As Used Non-factor When Declaring Pointers?
Jul 3, 2010
I've seen all three uses:
type * pointer
type *pointer
type* pointer
Are these 3 forms essentially the same, i.e., is the spacing as used here a non-factor when declaring pointers?
View 2 Replies
ADVERTISEMENT
Mar 23, 2010
Is it not possible to declare a vector inside a C++ class ? Have a look at the following code:
Code:
#include <stdio.h>
#include <iostream>
#include <malloc.h> // malloc
#include <strings.h> // bzero
[code]....
View 2 Replies
View Related
Mar 23, 2010
We have a STM32F103ZET6 microcontroller.It has an ARM cortex-M3 core.We use keil as compiler.We have both an external and internal SRAM.Now I want to declare variables in either of the RAM as I wish.For example some time critical section variables in internal and others in external.How to do this.?
View 1 Replies
View Related
May 14, 2011
Does declaring variable inside a function give an extra overhead on an application? Would it be better to declare the variable globally and just reuse it? Example
Code:
#include <blah>
char mybuffer[2048];
int main()
[code]....
The only difference is the declaration of my variable. Since myfunction() will be called many times will it add an additional overhead if it will create mybuffer[2048] over and over?
View 5 Replies
View Related
Mar 27, 2010
I wonder why arrays in the C programming language are pointers to the first element of the array, not the first element of the array itself?
View 14 Replies
View Related
Jan 15, 2011
I tried to summarize the this as best as possible in the title. I am writing an initial value problem solver in the most general way possible. I start with an arbitrary number of initial values at arbitrary locations (inside a boundary.) The first part of my program creates a mesh/grid (I am not sure which is the correct nuance), with N points total, that contains all the initial values. My goal is to optimize the mesh such that the spacing is as uniform as possible. My solver seems to work half decently (it needs some more obscure debugging that is not relevant here.)
I am starting with one dimension. I intend to generalize the algorithm to an arbitrary number of dimensions once I get it working consistently. I am writing my code in fortran, but feel free to reply with pseudocode or the language of your choice.Allow me to elaborate with an example:Say I am working on a closed interval [1,10]
xmin=1
xmax=10
Say I have 3 initial points: xmin, 5 and xmax
num_ivc=3
known(num_ivc)=[xmin,5,xmax] //my arrays start at 1. Assume "known" starts sorted
I store my mesh/grid points in an array called coord. Say I want 10 points total in my mesh/grid.
N=10
coord(10)
Remember, all this is arbitrary--except the variable names of course. The algorithm should set coord to {1,2,3,4,5,6,7,8,9,10} Now for a less trivial example:
num_ivc=3
known(num_ivc)=[xmin,5.5,xmax
or just
num_ivc=1
known(num_ivc)=[5.5]
Now, would you have 5 evenly spaced points on the interval [1, 5.5] and 5 evenly spaced points on the interval (5.5, 10]? But there is more space between 1 and 5.5 than between 5.5 and 10. So would you have 6 points on [1, 5.5] followed by 4 on (5.5 to 10]. The key is to minimize the difference in spacing.I have been working on this for 2 days straight and I can assure you it is a lot trickier than it sounds. I have written code that
only works if N is large
only works if N is small
only works if it the known points are close together
[code]....
So as you can see, I have coded the gamut of almost-solutions. I cannot figure out a way to get it to perform equally well in all possible scenarios (that is, create the optimum spacing.)
View 3 Replies
View Related
Sep 13, 2010
i'm practicing in very basic c programs using the gcc compiler.I found that when i create two variables let's say
Code:
int a,b and Code: a=15;
b=3;
a=b;
b--;
then a equals 2.I thought that this isn't normal in C isn't it?I haven't had the time to read the gcc documentation yet...so i think it has something to do with my compiler's default settings.I use the
Code: gcc filename.c -o filename command to compile
Are all variables defined like pointers?
View 5 Replies
View Related
Mar 23, 2010
So the place where I'm having a problem is here:
Code:
typedef struct {
void **Mem_Chunk;
[code]...
View 10 Replies
View Related
Jun 1, 2010
What is the difference between *ptr++ and (*ptr)++. In my opinion the terminology is all over the place so if you could give an example it would be better.
View 8 Replies
View Related
May 23, 2010
i'm a bit stuck playing with the following class setup for glut. The actual issue is with the function pointers.Basically the following code is the opengl redbook cube example slightly modified.
View 2 Replies
View Related
Jul 14, 2011
I need to call functions that match an input string (if input str = "func1", call func1), so I have this:
Code:
#include <stdio.h>
#include <string.h>
void function_a(void) { printf("Function A
"); }
[Code].....
In the above example, the functions take no input arguments. Can they take a different number of arguments, for example, function_a(int), function_c(int, int), function_e(int, char, int)? How can I do that?
View 3 Replies
View Related
Apr 12, 2010
I want to know is there some more efficient way of passing a pointer to a local variable as a parameter to a function in x86 asm? Right now I have to move the base pointer to a temp register, subtract from the register and pass that, like this (assuming a local var at esp-4):
Code:
mov eax, ebp
sub eax, 4
push eax
Is there a better way?
View 8 Replies
View Related
Feb 18, 2010
I'm trying to figure out how to code for this specific type of instance - I want to use a hash and have the key be a reference to an array, and not use the key in the standard way of it being a scalar. Basically, I have a large output that I need to process line by line, and rather have access to it as an array than a big block in a scalar. For the big block hash as a scalar I would do -
Code:
foreach $CONTROLLER (<CONTROLLER_LIST>) {
$ALL_DISKS{$CONTROLLER} = `ssh -n <commands>`;
}
Now I know I could take the scalar and split it to another array after the fact like -
Code:
@TEMP_HOLD = split (/s+/,$ALL_DISKS{$CONTROLLER});
How would I code it that I would have access to the key information as an array and not a scalar? I know it needs to be a pointer and we're going to have -> in there somewhere, but not sure how to approach it. Some of the documentaiton I've been reading about referencing I've found a little confusing so far, and trying to figure out how to use them in context of what I'm working on.
View 1 Replies
View Related
Mar 25, 2010
I am trying to find a way to pull Node Pointers out of the model, for use in other areas of the program. The solution is probably simple but I haven't had any luck finding it.
Model for a QTreeView:
Code:
class testModel : public QAbstractItemModel
{
public:
testModel();
~testModel();
[code]....
View 2 Replies
View Related
Feb 17, 2011
I have the most strange problem ever in programming. I fork a process into a parent and a child. In every forked process i declare a pointer, malloc and define a different value for every pointer.When i printf the value and the address guess what? They both have the SAME ADDRESS but DIFFERENT values, as assigned..Here's the portion of my code:
pid = fork ();
switch (pid)
{
[code]....
View 8 Replies
View Related
Jul 2, 2010
I following structure
typedef struct
{
[code]...
View 5 Replies
View Related
May 26, 2011
I have a 10x2 matrix, I create said matrix and fill it one column with zeros and the other with ones, now when I print the matrix I get this:
column 1:
0,0,0,0,0,0,0,0,1,1
column 2:
1,1,1,1,1,1,1,1,1,1
The first two rows of the second column are being replaced into the last two rows of the first column, now I even checked in visual studio and it works fine there. A friend tried my code and he gets it even worse:
column 1:
0,0,0,0,1,1,1,1,1,1
column 2:
1,1,1,1,1,1,1,1,1,1
As far as I've seen it must be a problem with GCC, unfortunately I need to have this up and running in GCC no matter what.
[Code].....
View 6 Replies
View Related
May 24, 2010
I want to declare a function in a function, but had no success till now, see the error code below and visit the project at sourceforge
[Code]...
View 14 Replies
View Related
Mar 3, 2010
I am trying to backup my system with a script I found here. It gives me an error message of invalid blocking factor for --exclude=lost+found I have no idea what this means. I tried to search this form for that message and received no hits.
View 2 Replies
View Related
Aug 3, 2010
I am currently running 8.10 with full-disk (excluding /boot) encryption. I am going to be installing 10.04 on a new laptop, and I was wondering whether it supports multi-factor authentication. Specifically, I would like to have a keyfile on USB/SD memory that is required, in addition to the password, to decrypt the disk. Anyone know of a guide out there? So far my searches have turned up nil.
View 9 Replies
View Related
Jan 13, 2016
I am trying to setup 2-factor authentication for SSH with PAM. Its working well, but if the password is incorrect, it does not ask for validation code, but rather asks for the password again. Any way not to warn about an incorrect password?
View 2 Replies
View Related
May 15, 2010
Since i'm on-the-road a lot encryption is crucial, with windows i've always used TrueCrypt and DiskCryptor, this is very easy to setup and allows me to create usb/cd devices that i can boot off and contain a keyfile, on boot it also requires a passphrase. Currently all i need to do is boot from harddisk and enter my passphrase. I would like to be able to boot from external device (in this case USB) that contains the bootloader and an integrated keyfile, also it should requist the passphrase. I found a guide on how to achieve two-factor authentication with dm-crypt on feisty but it's quite an old guide and is realy realy complicated for a newbie
View 1 Replies
View Related
Feb 15, 2010
The distribution I've been using does not have a proper two-factor login scheme. The daft buggers have configured the system so that whomever is sitting in front of a machine is gifted with the entire list of user names having access to the system. This, of course, only requires them to guess only one of the factors instead of both. So while said system is still a two-factor system it's one whose security has been crippled down to a single-factor system. Does anyone know which distributions have proper two-factor authentication schemes for logging in users?
No, I will not name the distribution I'm using so that a 'fix' can be provided. If the distributions creators have been willing to knowingly bugger the security of the system for the sake of user laziness at the login then heaven only knows what other holes exist. I have neither the time nor the inclination to discover or ask what they might be and how to 'fix' them as well. Better to simply move on to a distribution who won't knowlingly bugger the security.
View 9 Replies
View Related
Jan 28, 2010
Was wondering if anyone else had a work around for not being able to change the sensor's "factor"? I need to divide the fan speed by 2, but I'm not able to change anything in the configuration.
View 3 Replies
View Related
Jan 20, 2010
I'm looking to buy hardware to run my company's software.It usually runs on rack systems, but I want something that I can take with me on the plane, so a Small Form Factor system is what I'm looking for. My colleagues just stay in the server room, so don't know what to advise to take on the road ...
Here are the minimum specs:
- compatible with redhat 5.3
- 4GB of ram, extensible to 8GB
- 64 bits Intel processor, 2 or 4 cores.
[code]....
View 2 Replies
View Related
Jul 4, 2010
After falling out with KDE4.2.4 and using fluxbox for a while, I was sufficiently impressed with my experiments with KDE4.4.3 in slackware 13.1 that I decided to go back to KDE. In particular I'm keen to use plasma netbook on my eee pc 1000H.
But I've hit an annoying snag. The problem is that if I set it to use plasma netbook (System settings>Desktop>Workspace>Form factor>Netbook) it works just fine for the rest of that session but next time I startx it goes back to the Desktop form factor.
The strange thing is that this didn't used to happen, it only started recently and to the best of my knowledge I haven't made any other significant changes or updates to the system. I tried removing the ~/.kde dir and letting kde setup from scratch but that didn't help.
View 3 Replies
View Related
Apr 7, 2010
For anyone using Chromium [version 5.0.370.0 (43799) Ubuntu] from the daily PPA, are you seeing extra-space above the tabs?
View 8 Replies
View Related
May 11, 2010
Pt.1: Is this the right place for a question about Abiword? Pt.2: How does one set the line spacing in Abiword, wherever? Pt.3: . . . on an Asus eee netbook running Windows?
View 9 Replies
View Related
May 5, 2010
I upgraded to Lucid today and noticed that toolbar spacing/sizing is HUGE. In eclipse it is making my once single line toolbar wrap down to too. There is a ton of waisted space here.
View 5 Replies
View Related
Jul 11, 2010
Running Ubuntu 9.04 here and having some frequent problems in the terminal. The characters have "smooshed" together so some strings are unreadable. This happened randomly when I opened terminal and has been happening ever since. I don't know what the problem is.
BTW: I checked forums, two topics on this; 0 answers, go figure.
View 2 Replies
View Related