Suppose I have large array which I calculate an index into and pass to a second function. As a simple example, something like:
void foo(float* array, float c, unsigned int n)
{
for (unsigned int i = 0; i < n; ++i)
array[i] *= c;
}
void bar(float* restrict array, float* restrict array2, unsigned int m, unsigned int n)
{
...
why integer has a range between 0 and 32768?
...
I'm looking for a good way to do something like this:
typedef struct user
{
unsigned long id;
//userList defined below
userList friends;
}
typedef struct
{
//userList contains users
user * list;
int count;
} userList;
Is there a legal way to do this or something similar?
...
I am actually doing coding for a grid solver in C.
Now i have defined a function called void get_target(void){} which has to set the target_x and target_y coordinates to a value on 5*5 coordinate system. I want to traverse the grid in least possible time covering all points with minimum number of turns( only 90deg turns, 180 deg turns...
I'v some questions about zombie processes
what the benefits from zombie process concept?
know that the kernel keeps (PID,termination status, resource usage information) for zombie process
what's the meaning of "resource usage information"
how zombie's PPID() = 1 and it still zombie , (init reaps Zombies because it wait() by default)
...
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
...
I am building an application that consists of both a windows driver written in C and a user mode executable in c++. They both use a shared header file to define several macros, constants, enums, etc. In the c++ version, I want to include everything within a namespace, which a feature not supported by the c compiler. Is there certain v...
If this is Bubble sort then what is this?
Do you see the placement of Swap()?
...
Hello guys and gals!
Openssl is a great security library and I use it from time to time.
When I generate RSA keys I have RSA object with private and public key data. OK. Fine. I'm happy with that. I can print private key to the printer. And here come's the question.
Is it possible to create a valid RSA object only from the entered pri...
Hi,
How do I get the console handle of an external application?
I have a program running as a console. I have a 2nd program that will call GetConsoleScreenBufferInfo, but for that I need the console handle of the first program. Is it possible that given the HWND of the 1st program I can get its console handle?
...
Under Linux, C++, and GCC, can I get a physical address for a given virtual address? I know I won't be able to manipulate the physical address as a physical address.
...
We have the following code marshalling between c# and c dll. However, when print the value within the C dll function, the values associated with the double array properties are all 0.0000000. I have put some in line comments for the code having problems.
Did we miss any thing to configure the marshalling behaviour?
using System;
using...
I notice in several API's, that you may create a struct which is used internally and has nothing. ex:
ALLEGRO_BITMAP *bmp;
...
bmp->(intellesense shows nothing)
how do these types of structures work? are they simply handled like this internally?
REAL_ALLEGRO_BITMAP *realbmp = (REAL_ALLEGRO_BITMAP*)bmp;
or is there a cleaner soluti...
#define STRLEN 65
/*Create linked list */
struct node {
char str[STRLEN];
struct node *next;
};
newInput = malloc(sizeof(struct node));
strcpy(newStr, newInput->str);
I left the other parts of the code, but it doesnt seem to be copying the string into newInput->str.
The string accepted is only 64 bytes.
It's just blank when...
I'm writing a function in C that takes in a linked list and a predicate and returns an array containing all values of the linked list satisfying this condition. Here's the function:
void **get_all_that(list_t *l, int (*pred)(const void *)) {
void **vals = NULL;
int i = 0; // Number of matches found
const size_t vps = sizeof(...
Possible Duplicate:
Are there are any platforms where pointers to different types have different sizes?
I have read in several places that pointers of different types may have different representations in standard-conforming C implementations. This is one thing that makes it necessary to cast pointer arguments to printf, e.g....
I am trying to create a program which, given an input file, returns the count of all the lines of code in the input file, excluding blank lines and comment lines. I have written the following code, however I need help with how to exclude lines containing comments and blank lines.
#include<stdio.h>
int main()
{
int count;
char ch...
I have yet another newbie C question:
Why does the first member of a struct return an adress not similar to the structs own pointer-adress when not initialized?
Example:
struct Metadata {
int message_ID;
//other members...
//...
};
struct Metadata* baseMetadataPtr = (struct Metadata*) malloc(sizeof(struct Metadata)*100);
...
My view is that a C implementation cannot satisfy the specification of certain stdio functions (particularly fputc/fgetc) if sizeof(int)==1, since the int needs to be able to hold any possible value of unsigned char or EOF (-1). Is this reasoning correct?
(Obviously sizeof(int) cannot be 1 if CHAR_BIT is 8, due to the minimum required r...
Though i'm currently interested in internet explorer address space i wouldn't mind a general answer. The question is how can i calculate the address space ( and by address space a mean the minimum and maximum address in memory -correct me if i'm wrong- ) of a windows process.
Actually is this space fixed or varied ? Also do i get to kno...