473,544 Members | 1,960 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
2,430
thread by: Rick | last post Nov 13 '05 by: Rick
Hi, Another question for today, it's about structs refering to each other. I tried this code struct List; struct child { struct List parent; };
5
5,173
thread by: Jason | last post Nov 13 '05 by: Al Bowers
Hi everyone: I was trying to pass a pointer to a structure to a function, where the pointer is pointing to one of the members in the structure, is this possible??? For Example: struct reptile *animalPtr
5
1,867
thread by: Quing | last post Nov 13 '05 by: Keith Thompson
I'm attempting to adapt some code I got from http://www.inquiry.com/techtips/cpp_pro/10min/10mon0599.asp (line 1 is #include <stdio.h> - see the HTML source). Of course before adapting it, I need to get it working. With GCC I'm getting errors starting on line 4 ('parse error before "NODE"'). This evidently has something to do with the fact...
5
3,086
thread by: Mantorok Redgormor | last post Nov 13 '05 by: Mark A. Odell
What do some of you guys prefer? static int foo(void); int main(void) { return foo(); } static int foo(void)
5
8,179
thread by: Fernando | last post Nov 13 '05 by: those who know me have no need of my name
Hello, I want do a program what find the date of the one before day at day what the program run (if today is 20031030, the program will find 20031029). I have the next: #include <stdio.h> #include <time.h> int main() { struct tm *ptr;
5
4,592
thread by: J. Wesolowski | last post Nov 13 '05 by: lutnicx
Hello, This is my first approach to comp.lang.c, so hello to everyone. I learn c programming from "Teach yourself c " by Aitken & Jones. So far everything is going well and I'm quite excited about being able to write my own simple programs, but I'm stuck at one point. I can't figure out recursion of a function in a simple way. Do you have any...
5
2,089
thread by: Terence | last post Nov 13 '05 by: Christopher Benson-Manica
I usually program in Java, so I am a bit confused about usint pointers in C. I would really appreciate if someone can help me. Case 1: ====== // Is this function no good? Since str is a variable created on stack, // I am assuming it will be deallocated immedately after the function returns, // right?? char * generateString()
5
2,313
thread by: Stu | last post Nov 13 '05 by: Chris Torek
Does any body have any "C" code, which there willing to share, that can normalize a tm structure, which goes past the 2038 EPOCH. For example, I have the following tm stucture, which is set to the EPOCH /* Tue Jan 19 03:14:07 2038 */ epoch = { tm_sec = 7
5
16,072
thread by: Leonardo Custodio | last post Nov 13 '05 by: John Swanson
Has anyone worked or have any hints on how to get the Processor Serial Number in C? I've read the material within the Intel(C) webpage, but it only gives me the CPU ID table, no information on where (memory) to get it. Thank you, Leonardo Custodio aliensprite@hotmail.com
5
4,977
thread by: Park, SungJae | last post Nov 13 '05 by: Mark McIntyre
I found sizeof in table of Precedence hierarchy for C. is it a operation? which have precedence..?
5
3,418
thread by: Bill Cunningham | last post Nov 13 '05 by: Mark Gordon
I'm trying to write a program that will take ROM and show the values. Is that address 0-255? Would this involve malloc or memcpy? How can you alter memory values if you do know how to find them? Bill
5
3,600
thread by: Neil Zanella | last post Nov 13 '05 by: CBFalconer
Hello, I am curious as to why the designers of C did not include support for Pascal-like nested procedures. I guess that it's because nested procedures in C would not buy you much other than marginally cleaner namespaces, and then again C has a static keyword for limiting the scope of functions to a file, which is not quite the same, but...
5
2,391
thread by: Andy | last post Nov 13 '05 by: Sheldon Simms
Hi I am writing a small calculator program using switch() for a menu. The menu is presented at first, selection read in via scanf(), and calculation is executed. At the end of the operation, the menu is presented again. When it is presented again however, it is printed twice. I've been through the code and cannot spot any obvious errors,...
5
9,302
thread by: gc | last post Nov 13 '05 by: Ben Pfaff
I came across certain code with lot of declarations like: int foo(const double bar,const int m); I do not see any point in making a non pointer parameter a const, or am I missing something?
5
1,413
thread by: Vijay Kumar R Zanvar | last post Nov 13 '05 by: Dan Pop
The following statement exchanges int a & b. a = (a+b) - (b=a); Is there any trade off here? Thanks.
5
10,425
thread by: James Leddy | last post Nov 14 '05 by: Mansour Al-Aqeel
Hello, I need to write a program that will flash random numbers in the first line of output. The first number flashed will only remain on the screen for about 10 milliseconds. Then another number should appear in the same place 190 milliseconds later. I don't know how to approach the problem of putting the standard output buffer back to...
5
2,007
thread by: marty | last post Nov 13 '05 by: Eric Sosman
As part of an assignment I need to calculate a 24 hour time by subtracting a one time from another e.g. if the user enters 1.00 as the time and 1.30 as the time to subtract the returned time is 23.30 the previous day. This is straightforward when dealing with positive times. But when negative times are introduced (as above) it all gets...
5
2,652
thread by: uydo\(kiboga\) | last post Nov 13 '05 by: uydo\(kiboga\)
Hello, I have to write a program that reads from a text file into a structure. Every line in the file looks like this: "1234","first.last","password" I dont know if there is a function to pass the above line into a structure emp{"1234","first.last","password"}. If this is not the case, what is your suggestion to do the job? Thanks in...
5
4,335
thread by: zambak | last post Nov 13 '05 by: Simon Biber
Hi I have assignment for some wierd compression alghoritam that will read in from a file convert characters to 5 bit codes and then write out compressed version of the original file. For example if input file contains string "AMIR" and the codes are A=0, M=12,I=8,R=17 i am supposed to write out 3 byte file The problem? How do I figure...
5
4,759
thread by: Hongzheng Wang | last post Nov 13 '05 by: Thomas Matthews
Hi, everyone I have a problem about malloc/free function. Does malloc add size information to program? And, when free function is called, how this function get the size information? That is, if I request a memory block of size 10, where the size information 10 is stored? To be clear, I have such codes below: int *p = (int *)...
5
1,838
thread by: Michael Schwab | last post Nov 13 '05 by: Michael Schwab
Hi, I am an artist with limited computer knowledge (but I am able to compile some code) who needs for a project I am working on a way to read in a bmp file, loop through the pixels and store their rgb value in a file in the format (x, y, r, g, b). I want to use these values as the basis for some paintings. I looked around on the internet...
5
1,729
thread by: @(none) | last post Nov 13 '05 by: Martin Ambuhl
I have the following file: bugtest.c I compile it on a RedHat Linux machine, using gcc ehud@localhost ~>gcc --version gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or...
5
6,365
thread by: achrist | last post Nov 13 '05 by: those who know me have no need of my name
Here's a program: #include <stdio.h> int main(int argc, char **argv) { double an_array = {0.0, 1.0, 2.0, 3.0, 4.0}; typedef struct a_struct {double v0, v1, v2,v3, v4;} a_type; typedef a_type *a_type_ptr; a_type_ptr s_ptr;
5
31,319
thread by: Sai Krishna M | last post Nov 13 '05 by: Christopher Benson-Manica
Lvalue Required......Why? Hello all, the following code is not compiling in Turbo C and the error is "Lvalue Required" . main() {
5
3,001
thread by: davej | last post Nov 13 '05 by: CBFalconer
Hi, I've been working on an opensource project for most of this year. The group has adopted the use of macros in place of function calls when wanting to simplify a function. #define get_sensor_values(s1, s2, s3) \ do { \ if(s1>s2) { \ if(s->e != NULL { \ id = s3->id; \ OID defined\n"); \

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.