473,574 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C / C++ Forum

C / C++ programming language - Get answers to questions about compilers, visual C++, templates, namespaces, classes, data structures, OOP (object-oriented programming), inheritance, data types, exceptions, Standard Template Library (STL) and the C Standard Library.
5
1,997
thread by: herrcho | last post Nov 13 '05 by: Peter Nilsson
#include <stdio.h> #include <stdlib.h> #include <string.h> void select_sort(void *base, size_t nelem, size_t width, int (*fcmp) (const void *, const void *)) { void *min; int minindex; int i,j;
5
1,438
thread by: Bill Cunningham | last post Nov 13 '05 by: Serve La
Can anyone tell me what I'm doing here. #include <stdio.h> #include "p.h" extern int show(const char *p){ printf(%c,p);} Compile into p.o
5
6,479
thread by: Matt | last post Nov 13 '05 by: Julian V. Noble
I am writing a recursive program to draw the lines recursively, given the range and number of intervals (n) between the range. The problem is I don't know how to draw the line in point 0.375, as you see below. Please advise! Thanks! #include <iostream> using namespace std;
5
4,541
thread by: Yodai | last post Nov 13 '05 by: Yodai
Hi all! I have an int that comes with a value like 0x07fa and I have to turn it into a float value of 204.2 decimal to display it.... if I try to divide it by 10 I get bogus numbers. I presume I have to make it decimal before calculating, but I am not sure about it. Any light upon this simple (or it seems to me so, at least) begginner...
5
6,938
thread by: godhand | last post Nov 13 '05 by: those who know me have no need of my name
Does any here knows how to use unicode in c program to display like japanese or Russian characters? thanks
5
2,296
thread by: Kemal Ozan | last post Nov 13 '05 by: Kemal Ozan
Hi, I am studying K&R book. On the multidimensional Arrays chapter they say "int (*daytab) is a pointer to an array of 13 integers. The parenthesis are necessary since brackets have higher precedence than *. Without parenthesis, the declaration int *daytab is an array of 13 pointers to integers."
5
3,479
thread by: Gabriel | last post Nov 13 '05 by: Gabriel
Hi, I have a problem with the c-api function mysql_query. When I try to send these query "SELECT a FROM b" the function mysql_query hang's up and the program stops at the codeline. If I kill the programm, the bash said segmentation fault malloc_consolitat error. I have mysql version 4.15
5
2,567
thread by: Allan | last post Nov 13 '05 by: Darrell Grainger
Hi all, I've a C program which was originally developed under Sun Solaris(OS,2.6,gcc 2.95). I'm trying to migrate it to our linux system(Mandrake 9.0,2.4.19,gcc 3.2). Following is the MAKEFILE: CC=gcc
5
2,487
thread by: hongky | last post Nov 13 '05 by: emerth
"pthread_delay_np" function can make a thread sleep, but it is a function in Unix and not POSIX, so i did not compile my code...what to do for me?? i just want to make a sleep for the thread, RedHat Linux thread lib has not pthread_delay_np function, how to do? thx.
5
6,530
thread by: s | last post Nov 13 '05 by: Tim Hagan
If I have: unsigned char value = 0xBD; unsigned char 2bits = 0x02; How do I set the two MSB in value to the two LSB in 2bits without changing any other bits in value? <mytry> value &= 0x3F; //set those two bits to zero
5
2,955
thread by: kelvSYC | last post Nov 13 '05 by: James Hu
I have a declaration of a pointer to an array of a struct as follows: struct foo (*a); And I have an array of a struct as follows: struct foo b; However, a = &b returns an error (illegal assignment to constant).
5
1,746
thread by: Grant | last post Nov 13 '05 by: pete
Are the bitwise operators >>, <<, &, |, ~, ^ only defined for non-negative values? The little program below produces the output 3 255 I expected to get the 3 but why does it produce the 255 when the variable c is not typecast first?
5
1,578
thread by: Valentin Tihomirov | last post Nov 13 '05 by: Dan Pop
I have a .c file with a general code. It can be compiled with different constants for different applications. For example char a; where BYTE_SIZE is a constant defined in an external (.h?) file.
5
2,028
thread by: Mantorok Redgormor | last post Nov 13 '05 by: Richard Bos
If I do something like the following: unsigned int bar=10; Then use, -bar with the unary '-' and assign this value to an int, does this invoke undefined behavior in anyway? Basically I have: unsigned int bar=10; int foo;
5
3,511
thread by: maths_fan | last post Nov 13 '05 by: Irrwahn Grausewitz
How to make (link) the program with it? Is there anyone who works with vgl?
5
1,395
thread by: maths_fan | last post Nov 13 '05 by: Mathew Hendry
What style do you prefer? Where to place brackets? How to name variables, functions, constants, etc. How do you format your source code? Do you write comments?
5
7,247
thread by: Susan Sherpi | last post Nov 13 '05 by: Ed Morton
Hi. Thanks to Eric Sosman for showing me what was wrong with my code in an earlier posting. He wrote, quoting me: >> I want to read a line of decimal integers from standard input into an >> array, stopping when a newline is encountered, and I'd like the >> function to return the number of values read in. >> >> ----------------------------...
5
2,383
thread by: Brooks1083 | last post Nov 13 '05 by: Jirka Klaue
Could someone who is knowledgable about C please IM me. I'm having a problem with my C program and have been working at it for like 5 hours, I know it's something simple.
5
3,819
thread by: Sönke Tesch | last post Nov 13 '05 by: Sönke Tesch
Hi everybody, I have a problem with the following piece of code: 141: /* A data block to manage a single log target: */ 142: typedef struct { 143: apr_reslist_t *dbs; /* connection pool */ 144: 145: const char *uri; /* the complete log uri.. */
5
4,797
thread by: Mark Shelor | last post Nov 13 '05 by: Arthur J. O'Dwyer
Problem: find a portable way to determine whether a compiler supports the "long long" type of C99. I thought I had this one solved with the following code: #include <limits.h> #ifdef ULONG_LONG_MAX
5
1,958
thread by: Vivek | last post Nov 13 '05 by: Joona I Palaste
Hi, I am trying to get as much information on void pointers. How do we take help of void pointers in writing generic functions. I have seen this kind of code for many years, but now I have got a chance to write some myself. Could anybody point me to a link where I can get more info for the same, or refer me a book having more detail...
5
16,315
thread by: No Spam | last post Nov 13 '05 by: Irrwahn Grausewitz
This is probably an easy question, but I have not used C for quite some time: How do I determine the size of an array? More specifically, how do I determine the number of incoming parameters? Thanks. T
5
1,323
thread by: Johnny Shih | last post Nov 13 '05 by: James Hu
Hi guys, I am having to figure out the recusion in this function. int recfn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return recfn(v/2)+2;
5
10,135
thread by: Neil Zanella | last post Nov 13 '05 by: Christian Bau
Hello, Unlike in pre-C99 versions of C where variables can only be defined at the beginning of blocks, C99 allows variables to be defined in arbitrary places inside blocks. However, gcc 3.2.2 seems to reveal that there are still places where this is illegal. For instance, consider the following code snippet. int main(void) { int i = 0;
5
17,600
thread by: Roy Hills | last post Nov 13 '05 by: Peter Shaggy Haywood
When I'm reading from or writing to a network socket, I want to use a struct to represent the structured data, but must use an unsigned char buffer for the call to sendto() or recvfrom(). I have two questions: 1. Is it generally safe to "overlay" the structure on the buffer, e.g.: unsigned char buffer;

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.