What is the difference between atol() & strtol()?
According to their man pages, they seem to have the same effect as well as matching arguments:
long atol(const char *nptr);
long int strtol(const char *nptr, char **endptr, int base);
In a generalized case, when I don't want to use the base argument (I just have decimal numbers), whi...
C code targeting x64, as has been previously discussed, should always use size_t instead of int for things like counts and array indexes.
Given that, it would arguably be simpler and less error prone to just standardize on size_t (typedef'd to something shorter) instead of int as the usual integer type across the entire code base.
Is t...
I have a struct with many char array like this (and it works) :
struct maytinh {
char tenmay[10];
char mamay[10];
char test[10];
float manhinh;
int gia;
};
But if its like this,
struct maytinh {
char tenmay[99];
char mamay[99];
char test[99];
float manhinh;
int gia;
};
it breaks when I compil...
Possible Duplicate:
What's does mean in an argument list in C ?
function fun1(...)
{
}
Please tell me about what is the use and how to use ellipsis operator in c.
Thanks,
...
I am trying to take five character and 5 float input.
main()
{
char c[5];
float q[5];
int i;
for(i=0;i<5;i++)
{
printf("\n%d ",i);
scanf("%c",c+i);
scanf("%f",q+i);
}
}
But the output is absurd. After two sequential scans, it skips third scan and then again skips fifth scan.
I am not ab...
I'm trying to figure out how to use Mathematica from C via Mathlink.
If I just want to compute the value of a built-in function, I can do
MLPutFunction( lp, "RiemannSiegelZ", 1L);
MLPutDouble(lp, val);
and all is fine.
Now, if I want the value of the derivative, things get worse:
MLPutFunction( lp, "RiemannSiegelZ'"...
OK, so I know you're generally not supposed to compare two floating-point numbers for equality. However, in William Kahan's How Futile are Mindless Assessments of Roundoff in Floating-Point Computation? he shows the following code (pseudo-code, I believe):
Real Function T(Real z) :
T := exp(z) ; ... rounded, ...
I need a code or help to write a code in c or java to demonstrate the power of map reduce.
...
Hello,
how can I get a list of all C API functions with Lua?
For example, there are plenty C functions in a game(Crysis) which
can be called with
Lua:
g_gameRules.game:FunctionInC()
There are many functions I know but how can I get all available functions?
...
I use this function to create random numbers between 100000000 and 999999999
int irand(int start, int stop) {
double range = stop - start + 1;
return start + (int)(range * rand()/(RAND_MAX+1.0));
}
When I use it like this, it's properly working
while(1) {
DWORD dw = irand(100000000, 999999999);
printf("dynamic key: %d\n",...
Hi
I am storing samples using a text file in my C program. I want to plot a waveform using those values in excel. How can I export data to excel from program???How can I do that??? otherwise Is there any other way to plot waveform in C program itself???
Thanks in advance...
...
I love the ideas presented in Brian Kernighan and Rob Pike's book, "The UNIX Programming Environment," where they focus on the point of working within an environment where you can put together many (small, precise, well understood) programs on the command line to accomplish many programming tasks.
I'm brushing up on strict ANSI C conven...
I know it's been the convention in ANSI C to always return a 0 integer value from main in a C program, like this:
int main() {
/* do something useful here */
return 0;
}
This is to return a "successful" result to the operating system. I still consider myself a novice (or an intermediate programmer at best) in C, but to date...
Here is the code,
int array[X][Y] = {0,};
// 1 way to access the data
for (int x = 0; x < X; x++)
for(int y = 0; y < Y; y++)
array[x][y] = compute();
// the other way to access the data
for (int y = 0; y < Y; y++)
for (int x = 0; x < X; x++)
array[x][y] = compute();
Is it true that the first way is more efficient than th...
When writing in C, how can I tell how much stack space is available in memory when I launch a program? How about heap space?
How can I tell how much memory is being used during the execution of my program?
...
I've been interested in the problem of finding a better prime number recognizer for years. I realize this is a huge area of academic research and study - my interest in this is really just for fun. Here was my first attempt at a possible solution, in C (below).
My question is, can you suggest an improvement (without citing some other...
How do you determine what the cycle cost is for a given C library function?
Specifically, how expensive is it to call sqrt()?
I should clarify here, I'm just looking for a general idea of the cost associated with calling certain C library functions. I'm assuming that professional C programmers just have a basic idea of function cost f...
Quoting from here,
In C, there are two different namespaces of types: a namespace of struct/union/enum tag names and a namespace of typedef names.
name.c
$ cat name.c
#include<stdio.h>
typedef long long long2;
int long2 () {
return 4;
}
int main() {
printf("hello, world!");
return 0;
}
$ gcc name.c -o name
name.c:4...
I am new in the field of gtk+ programming. I'm still exploring many options to use. I will be coding in C language. I have the following questions:
Which is better? Writing code or using the .glade files generated by glade?
Which is better to use? libglade or gtkbuilder?
Why is using the build option in glade2 discouraged?
...
hi,
I am new in the filed of gtk+ programming. I have glade-2.6 installed on my linux system. When i try to build my gui it gives 2 options- C and LibGlade. However for libglade it says that it is deprecated and that i should use intltool instead. What does it mean and why is LibGlade deprecated?
...