Can anyone give me an example of a Java program which has two native methods declared and defined in C and C++. Actually, I need a procedure as well as the code, so that I can run it and learn from it, thanks.
...
Tips on how to do multiplication table in c??
...
I was wondering whether there's a better way of doing this; say we read stdin to a string using fgets() where the string includes a total of n integers (e.g. 5 16 2 34 for n = 4), what would be the best way of extracting them? There has got to be a better way than this hack:
for (i=0, j=0; i<n; ++i, j+=pos)
sscanf(string+j, "%d%n",...
I have a function
void func(int x, char *str, ...)
{
...
}
I am invoking it as follows:
func(1, "1", "2", "3");
How can I print the values of all the extra arguments (2, 3) in function?
...
Why is a bit, called a bit. Why is a 8-bits a Byte? What made people call a 16-bits a Word, and so on. Where and why did their alias come about?
I would love other people to include things like basic ASM types, then branch out to C/C++ and move on to SQL and the like's datatypes.
1-Bit
Bit - binary Unit
Bool - Named after the invento...
Hi,
I've wrote CGI script for www.
This script expects two parameters through GET method, multiply these numbers and write result into the file.
mult.cgi?m=1&n=2
But now I want to use this script from console too.
I'tried something like
./mult.cgi?m=1&n=2
But it didnt work, how can I send parameters to script?
thanks.
...
On my system, I get:
sizeof ( int ) = 4
sizeof ( long ) = 4
When I checked with a C program, both int & long overflowed to the negative after:
a = 2147483647;
a++;
If both can represent the same range of numbers, why would I ever use the long keyword?
...
On opening a directory via zwopenfile(open directory option), it returns a handle for the directory path. Now I need to get the directory path from the handle. Its my requirement.
I could see an example(please see the code below) where file name can be fetched from file handle. But the below example does not help for directory. Is ther...
From my lecture slides, it states:
As illustrated in the code below an array name can be assigned
to an appropriate pointer without the need for a preceding & operator.
int x;
int a[3] = {0,1,2};
int *pa = a;
x = *pa;
x = *(pa + 1);
x = *(pa + 2);
a += 2; /* invalid */
Why is a += 2; invalid?
Can anyone help clarify...
I am new to cuda and graphics. I had several questions about cuda, hope someone will have proper answers:
These are for driver API:
-- What is the meaning of a cuda context? when i was reading cuda c book (3.1) i've learned that it is analogous to a process in CPU. I don't understand this, the actual host c code becomes a process in cp...
int main()
{
int x=-1, y=-1;
if(++x=++y)
printf("pppppppp");
else
printf("cccccccc");
}
...
I'm a novice user of C language. I have a problem in allocating a dynamic array.
I used to allocate memory outside the loop such as a=(int*)malloc(5* sizeof(int)); and every thing worked fine. Now I want to allocate memory to each element one by one in a loop using malloc(), but the code is not working.
I've tried different options li...
Why is the IPv4's decimal value different with inet_pton and inet_addr (1734763876) than what you get if you use these 2 websites (1684366951) ?
struct sockaddr_in sin;
inet_pton(AF_INET, "100.101.102.103", &(sin.sin_addr));
printf("%i\n%i\n", inet_addr("100.101.102.103"), sin.sin_addr);
http://www.allredroster.com/iptodec.htm
http:/...
hello everyone I have this snippet of the code
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct Date {
int date;
char* month;
int year;
} Date_t;
typedef Date_t* pDate_t;
void assignMonth(pDate_t birth)
{
//1)
birth->month = "Nov";
//2)
//birth->month = malloc(sizeof(char) * 4);
...
A read some posts here and google and don´t find a substancial answer. Supose I have a largest number and I have to assing to a variable. The problem raise when I have a GUI where the user will enter the number. How I can´t know what the value the user will put in a field (let´s think in a UItextField), when I get the number and then ass...
hello everyone, let's assume I have this snippet of the code:
void foo_for_foo( void some_function(int, int)) <------
{
int x = 5;
some_function(x, x);
}
and also this one (actually the same with small difference)
void foo_for_foo( void (*some_function)(int, int)) <-------
{
int x = 5;
some_function(x, x);
}
my...
hi
i have come across a line that is given below
char *ch=(char*)3000
i want to know the meaning of this line .....
...
I want to make some printf's to the windows console from my C program but want to make some of them different colours.
Anyone know if this can be done easily?
EDIT: Windows XP is my OS
...
I use pthread_create to create several child threads. At a time, the main thread wants to kill all child threads or there will be segment falut. Which function should I use to finish that? I searched the answer from google and got function like pthread_kill. But I did not know which signal should I send to the child thread to kill them. ...
I do something like that in the loop :
char* test = "\0";
test = strcat(test, somestr);
...
char* tmp = strstr(test, 0, len);
free(test);
test = tmp;
And get memory leak. What I do wrong?
...