For reasons I completely disagree with but "The Powers (of Anti-Usability) That Be" continue to decree despite my objections, I have a sorting routine which does basic strcmp() compares to sort by its name. It works great; it's hard to get that one wrong. However, at the 11th hour, it's been decided that entries which begin with a number...
Hello all. I have a question regarding linked lists. I have the following structs and function for example.
struct node {
int value;
struct node *next;
};
struct entrynode {
struct node *first;
struct node *last;
int length;
};
void addnode(struct entrynode *entry) {
struct node *nextnode = (struct node *)malloc...
This code produces a segmentation fault during the array declaration. I'm confused as to why this happens. I intentionally selected 2000000000 as a value because it is below 2^31 and can fit into an integer variable.
int main()
{
int nums_size = 2000000000;
int nums[nums_size];
int i;
for(i = 0; i < nums_size; i++) ...
Hey guys,
The following code produces a "lvalue required as left operand of assignment"
if( c >= 'A' && c <= 'Z' || c = " " || c = ",") {
I assume I'm writing this wrong, what is wrong? and how would I write it correctly?
I would appreciate any help! :)
Thanks.
...
Hi folks,
Actually, I am very new to Mobile programming, and need to take your opinions.
I am a Java Developer with a C background, and I need to start Learning Objective-C with a target to do mobile app for iPhone and to refresh my knowledge in C (as I know, Objective-C is a pure superset for C, ain't it?).
So, the question is, With...
I am receiving this error
>GXRenderManager.obj : error LNK2001: unresolved external symbol "private: static class GXRenderer * GXRenderManager::renderDevice" (?renderDevice@GXRenderManager@@0PAVGXRenderer@@A)
The following is my code...
GXDX.h
class GXDX: public GXRenderer {
public:
void Render();
void StartUp();
};
GXGL....
Hi,
I want to learn C , UNIX and LINUX, and more about embedded systems. Very much interested in them. Are there any online courses or websites which can guide me. And please suggest books to read in learning them.
Thanks for your time.
Ya please lets your answers and comments come in , they are invaluable to me..!!
...
how i can read mib file in a router using cprogramming language or any other programming languages can you give me example source code?
thanks
...
What is the size of this array?
float a[10];
...
I am trying to create a simple python extension module. I compiled the following code into a transit.so dynamic module
#include <python2.6/Python.h>
static PyObject*
_print(PyObject* self, PyObject* args)
{
return Py_BuildValue("i", 10);
}
static PyMethodDef TransitMethods[] = {
{"print", _print, METH_VARARGS, ""},
{NULL,...
Hi,
I have two functions in C:
function1(){
// do something
}
function2(){
// do something while doing that
}
How would i run these two at the exact same time?
If possible, please provide an example!
...
I'm really sorry if this sounds kinda dumb. I just finished reading K&R and I worked on some of the exercises. This summer, for my project, I'm thinking of re-implementing a linux utility to expand my understanding of C further so I downloaded the source for GNU tar and sed as they both seem interesting. However, I'm having trouble under...
I am facing an issue while dividing a double with an int. Code snippet is :
double db = 10;
int fac = 100;
double res = db / fac;
The value of res is 0.10000000000000001 instead of 0.10.
Does anyone know what is the reason for this? I am using cc to compile the code.
...
I've got an enumeration in my game. A simple string message with an appended PacketType is being sent with the message (so it knows what to do with the message) over GameKit WIFI connection. I used Apple's GKRocket sample code as a starting point.
The code itself is working fantastically; I just want to understand what the line with CF...
Hi, I have been trying to execute this program on my migw ,through code::blocks,
#include <string.h>
#include <math.h>
#include <stdio.h>
#define N 100
int p[N];
int pr[N];
int cnt;
void sieve()
{
int i,j;
for(i=0;i<N;i++) pr[i]=1;
pr[0]=pr[1]=0;
for(i=2;i<N;i++)
if(pr[i])
{
p[cnt]=i; cnt++;
...
How is the scope of a variable/identifier maintained in the symbol table of a c/c++ compiler.
Please suggest some good links and books to know the how compiling process of c/c++
program is implemented for better understanding.
...
Hi there,
I have an algorithm for creating the sieve of Eratosthenes and pulling primes from it. It lets you enter a max value for the sieve and the algorithm gives you the primes below that value and stores these in a c-style array.
Problem:
Everything works fine with values up to 500.000, however when I enter a large value -while run...
As apparent in the title, I'm questioning the reason behind defining the macros inside a struct. I frequently see this approach in network programming for instance following snippet:
struct sniff_tcp {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
tcp_seq th_seq; ...
Hi,
I'v created a C header file (It's compiled), now when i compile my program it comes up with tons of errors like:
warning: null character(s) ignored
error: stray ‘\23’ in program
TheFunctions.h:1722: error: stray ‘\200’ in program
Inside the header file is simply two functions, which work in the normal c program.
Please help!
...
After profiling a large game playing program, I have found that the library function rand() is consuming a considerable fraction of the total processing time. My requirements for the random number generator are not very onerous - its not important that it pass a great battery of statistical tests of pure randomness. I just want something...