Sometimes the 'case' statement is forgotten also. When using symbols instead of values, these are interpreted as labels also.
switch(x)
{
FIRST:
SECOND:
THIRD:
default:
}
The C "Integer and Floating point syntax" is nicely explained on the following page.
http://www-ccs.ucsd.edu/c/syntax.html
It shows a nice flow of how an integer number can be seen as a series of different characters. This can be used as the basis of your program. It also shows...
Just some thoughts:
Are you familiar with the isdigit() and isspace() macro's? (look at the manual page).
Wouldn't it be easier to advance through the input, rather than work backwards?
You need to look at what the C-constants are all about. Look at the syntax. Write a small scanner. You can...
First you need to write down which format you expect. E.g. leading + or - character, followed by a series of digits (for Long conversion). For double, optionally followed by a .-symbol and (mandatory) a series of digits. You need to consider if you support numbers such as .3
For long, take one...
There are a number of possibilities:
if (1 == sscanf(data,"%f",&F))
conversion OK
else
conversion failed
OR
F = atof(data)
or (better)
F = strtod(data,&end);
The strtod provides error values when the data is out of range, or just wrong. Look at the manual page for that...
I'm very curious to your implementation of addtoarray.
I am suspecting that you are overwriting a part of your stackframe, possibly resetting either i or size or both.
Tip: try to avoid testing against FALSE or TRUE: firstly, this may lead to code that looks OK, but behaves bad. Secondly, if()...
How about
fgrep "abcde:" filename | while read line
do
echo ${line#*:}
done > results
The ${line#*:} will drop everything before and including the first :
Macro's can really bother you like that. I'm using a kind of code-standard for macros that you might find usefull. The thing is that it uses a different naming scheme for macros than for ordinary functions.
E.g.
#define M_SomeMacro(parm1,parm2,parm3) { ... }
Preceeding a macro name with M_...
Hi fro,
My example "when using address registers, their contents could be volatile also (e.g. when pointing to the data register of a serial chip", the "contents" that I referred to are not that of the register itself, but of the data it points to.
Some registers of a CPU...
Hi
( echo PRODUCTION TARGETS ; echo "" ; echo "" ; cat fred )
would work also. The () is used if you want to redirect the output, e.g. ( echo 1 ; echo 2 ) > output
Pieter
If you start a normal program (not script) from a shell, a child process is used to run that program.
If you start a script, the script is examined to figure out which (shell) program to start. Subsequently, a child process is used to run that program (could be anything from bsh, sh, to perl or...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.