Hi, I have had to start to learning C as part of a project that I am doing. I have started doing the 'euler' problems in it and am having trouble with the first one. I have to find the sum of all multiples of 3 or 5 below 1000. Could someone please help me. Thanks.
#include<stdio.h>
int start;
int sum;
int main() {
while (start < 1...
char **Data[70]={NULL};
What is the correct terminology for this? How else could it be written? What does it look like in memory? I am reading many tutorials on pointers but I don't see it in this syntax. Any help is appreciated. Thanks.
...
Hi,
I would like to allocate a fixed memory for my application (developed using C). Say my application should not cross 64MB of memory occupation. And also i should avoid to use more CPU usage. How it is possible?
Regards
Marcel.
...
Hi, I have a doubt in my program
#include<stdio.h>
int myFunc(char **);
main()
{
char *a[2]={"Do","While"};
myFunc(a);
}
int myFunc(char **P)
{
/* Here I want to print the strings passed but I'm unable to
print the strings I just tried the below statement which
printed just the first letter which is 'D'*/
...
On Ring Buffer's Wikipedia entry, there's example code showing a hack for UNIX systems whereby the adjacent virtual memory to a piece of memory is mapped to the same phbysical memory, thus implementing a ring buffer without the need for any memcpy, etc. I was wondering if there's a way to so something similar in Windows?
Thanks, Fraser
...
I'm a bit new to C, but I've done my homework (some tutorials, books, etc.) and I need to program a simple server to handle requests from clients and interact with a db. I've gone through Beej's Guide to Network programming, but I'm a bit unsure how to piece together and handle different parts of the data getting sent back and forth.
Fo...
I want to monitor all the open windows under X11. Currently, I'm doing this as follows:
Initially walking the whole tree by recursively calling XQueryTree from the root window
Listening for substructure changes on the whole desktop: XSelectInput( display, root_window, SubstructureNotifyMask | PropertyChangeMask )
Handling all MapNo...
Can you point me to a reference of design patterns in Standard C (C89 or C99)? (Not C#, not C++.)
...
Can someone explain the following strange behavior?
I run the following program on a 64-bit Intel platform:
include <stdio.h>
#include <stdint.h>
int main(void)
{
int x;
int *ptr = &x;
printf("ptr = %p\n", ptr);
printf("sizeof(ptr) = %d\n", sizeof(ptr));
int64_t i1 = (int64_t) ptr;
printf("i1 = 0x%x\n", i1);
printf("si...
Alloca allocates memory from Stack rather then heap which is case in malloc. So, when I return from the routine the memory is freed. So, actually this solves my problem of freeing up of dynamically allocated memory . Freeing of memory allocated through malloc is a major headache and if somehow missed leads to all sorts memory problems.
...
I have a big number (integer, unsigned) stored in 2 variables (as you can see, the high and low part of number):
unsigned long long int high;
unsigned long long int low;
I know how to add or subtract some other that-kind of variable.
But I need to divide that-kind of numbers. How to do it? I know, I can subtract N times, but, maybe, ...
Does anyone know of a library for RDP that's written in C or Objective-C that is not GPLed?
...
I'm writing a little Python extension in C/C++, and I've got a function like this:
void set_parameters(int first_param, std::list<double> param_list)
{
//do stuff
}
I'd like to be able to call it from Python like this:
set_parameters(f_param, [1.0, 0.5, 2.1])
Is there a reasonably easy way to make that conversion? Ideally, I'd ...
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications.
So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict a...
We had a piece of code in C in one class where we needed to convert it to Y86 and this was written on the board by some guy with the teacher's correction of course.
However, I'm confusing the memory locations and .pos directives on the initial part of the code:
int array[100], sum, i;
int main() {
sum = 0;
for(i = 0; i < 100;...
I am wondering why the following two types
struct {
double re[2];
};
and
double re[2];
have the same size in C? Doesn't struct add a bit of size overhead?
Thank you in advance.
...
Using Code::Blocks w/ mingw, and trying to use GLee for some OpenGL on windows. I'm getting the following build errors:
GLee.c|60|undefined reference to `_wglGetProcAddress@4'
GLee.c|10748|undefined reference to `_wglGetProcAddress@4'
GLee.c|10751|undefined reference to `_wglGetCurrentDC@0'
GLee.c|10797|undefined reference to `_glGetStr...
I've been reading K & R's book on C, and found that pointer arithmetic in C allows access to one element beyond the end of an array. I know C allows to do almost anything with memory but I just don't understand, what is the purpose of this peculiarity?
...
I have heard of Boost and ACE as two of the well known C++ libraries. What are the other good C/C++ libraries available?
Does Boost and ACE support session management for web applications written in C/C++?
EDIT: Ok I will try to be domain specific. I am looking for a C/C++ library which could help me maintain session state for a C++ b...
I am trying to use SendInput() to send a sentence to another application (Notepad) and then send it hitting the Enter Key.
Any code snippets? Or help
...