I have the following code.
but i m getting incorrect output
can anybody define me that why output is 10 B only & why m not getting A in output.. ??
plz help me out......
#include<stdio.h>
#include<conio.h>
void main()
{
int *p;
char c,d;
int i;
clrscr();
p=&i;
*p=10;
(char *)p=&c;
*p=65;
(char *)p=&d...
#include <stdio.h>
enum bool
{
true, false
};
typedef bool
(*compare_fun) (int, int);
I get an error when I enter the above code. How do I make a function pointer that needs to return a boolean?
...
I have inherited an application that links to a library which MAY HAVE been built with gcc3. Or maybe with the imagecraft compiler. That information has now vanished to the heavenly bitfield and I am left with a libXXX.a library against which to link my app. I cannot recompile the libXXX.a because it requires certain unknown headers from...
This is a question in my paper test today, the function signature is
int is_match(char* pattern,char* string)
The pattern is limited to only ASCII chars and the quantification * and ?, so it is relatively simple. is_match should return 1 if matched, otherwise 0.
so, how to do, i am really dizzy on this?
thanks in advance!
...
I am using visual studio 2008.I'm facing problem while compiling pro C files.
It is not detecting the header files (stdio.h.....etc) even though i had specified the correct path
I have added the correct path to include directory
...
I tend to use std *alloc/free functions to allocate/free dynamic memory in my C programs.
I wonder if there are any good reasons to use the GLIB Memory Allocation functions instead of the std ones.
I'd be grateful if the comunity could point out situations where either of these solutions is a winner/looser. I am also interested in perf...
I have the following C99 program which measures performance of simple division operations relative to addition. However, the difftime function keeps returning 0 even though the program is clearly taking several seconds to process runAddition and runDivision with iterations set to 1 billion.
#include <stdio.h>
#include <time.h>
void run...
hello everyone can anybody help me with the DFS algorithm :
Path* agent_DFS (void* arg1,...);
which is written on C program and is about Artificial intelligence which I have to find a way for a car to his goal ..??
it returns an array of type path
I got absoloutely no idea about that ...
please help me
...
So i'm having trouble figuring how to overcome this.
Take for example, i have a red black tree implementation that works with items:
typedef unsigned long int Key;
struct rbt_node{
Item item;
int color;
Key key;
struct rbt_node* parent;
struct rbt_node* left;
struct rbt_node* right;
};
then in an Item.h i defi...
I'm planning to setup my own build server. I'm primary building C#, C/C++ and Java projects. I would also like my build server to run some external programs/scripts such as my unit tests, code static analysis and doxygen.
Suggestions?
...
Goal
I'm porting a filesystem to Windows, and am writing a more Windows-like interface for the mounter executable. Part of this process is letting the user locate a partition and pick a drive letter. Ultimately the choice of partition has to result in something I can open using CreateFile(), open(), fopen() or similar.
Leads
Windows s...
Most of the time in C programming it seems that there will be one header file (.h) per code file (.c), for the function prototypes at least.
When would it be appropriate to not have a header file for a code file?
...
I believe the malloc is badly assigned, why?
int ** array;
int i,j;
array=malloc(10*sizeof(int *));
for(i=0; i<10; i++)
for (j=0;j<10; j++)
array[i][j]=i*j;
...
bool print_date(Date *d, char **argv) {
if (isdigit(*argv+1)) {
return printf("is d");
} else {
return printf("is not d");
}
}
The above function don't work. *argv+1 is the user input, is it a string or what types when passing in? anyone can help?
int main(int argc, char *argv...
I am reading the C programing guide and all of a sudden it starts talking about pipes. Can someone simply tell me what a pipe is.
...
can i check in C(++) if an array is all 0 (or false) without iterating/looping over every single value and without allocating a new array of the same size (to use memcmp)?
i'm abusing an array of bools to have arbitrary large bitsets at runtime and do some bitflipping on it
...
I have a function which is passed two structures by reference. These structures are composed of dynamically allocated arrays. Now when I try to implement OpenMP I'm getting a slowdown not a speedup. I'm thinking this can be attributed to possible sharing issues. Here's some of the code for your perusal (C):
void leap(MHD *mhd,GRI...
Ok I have something like this:
struct dirent *dp;
DIR *dir;
char fullname[MAXPATHLEN];
char** tmp_paths = argv[1]; //Not the exact code but you get the idea.
...
while ((dp = readdir(dir)) != NULL)
{
struct stat stat_buffer;
sprintf(fullname, "%s/%s", *tmp_paths, dp->d_name);
if (stat(fullname, &stat_buffer) != 0)
...
can you give me an example of deleting characters from an array of characters in c?
I tried too much, but i didn't reach to what i want
That is what i did:
int i;
if(c<max && c>start) // c is the current index, start == 0 as the index of the start,
//max is the size of the array
{
i = c;
...
Rewrite this to minimize the assignment statements
/*
Build the list {1, 2, 3} in the heap and store
its head pointer in a local stack variable.
Returns the head pointer to the caller.
*/
struct node* BuildOneTwoThree() {
struct node* head = NULL;
struct node* second = NULL;
struct node* third = NULL;
head = malloc(sizeof(struct node...