15,550 Topics

Member Avatar for
Member Avatar for RexxX

Say I have [code] #include<iostream.h> int tempNum; struct node { int data; struct node *next; }; struct node *newNode = NULL; int main(void) { tempNum = 5; newNode->data = tempNum; //gives seg fault } [/code] *edit - I'm trying to add tempNum to the very first node. I haven't worked …

Member Avatar for Aia
0
101
Member Avatar for wollacott

ok i need to do a program that inputs a amount of characters. my program has to capitalize the first letter and and letter after a full stop. any ideas and hints how to do it?

Member Avatar for Dave Sinkula
0
79
Member Avatar for ankitbullu

What enables C to support variable number of function arguments (varargs), while other languages (like Java) do not support this feature? What is special in C which is not there in Java to support this?

Member Avatar for Narue
0
79
Member Avatar for wollacott

[CODE] #include<stdio.h> main() { static int n=0, number=1; int fibi (int n, int number); printf ("Following are the first 40 Numbers of the Fibonacci Series:\n"); printf ("1 "); fib (n,number); } fib (int n, int number) { static int i=1; int fibo; if (i==40) { printf ("\ndone"); } else { …

Member Avatar for pokiri
0
95
Member Avatar for cnoob3610

Hello all. Sorry to be a bother but I cannot figure out what is wrong with my homework program that's due before midnight. The assignment is to create a program with a two-dimensional array that generates a random walking path. I'll list the assignment as it is probably clearer. [I]Write …

Member Avatar for cnoob3610
0
110
Member Avatar for kwadders

Hi all, I am wondering if anybody has any good links for displaying floats. I have been working with some pre-written code that has bugs in, at the company i work for. But i keep having problems with rounding. I am considering re-writing it but what to get to grips …

Member Avatar for Aia
0
73
Member Avatar for hallinan

Need help I wont to get a system date as integers such as(22/02/2008) rather than string cause I need this to compare two dates any ideas?

Member Avatar for Dave Sinkula
0
83
Member Avatar for tomeagle

I am a beginner and need help with my program in C. My assignment is to find all the prime number up to the number the user input using a sieve algorithm. for example if user input 6 , the prime numbers will be 2, 3, 5. Then it should …

Member Avatar for VernonDozier
0
212
Member Avatar for wollacott

ok this is my code so far i have to use " isprime" to calculate prime number how do i do thatand where do i put it.thank you [CODE] #include<stdio.h> main() { static int n=0, number=1; // static: so value is not lost int fibi (int n, int number); printf …

Member Avatar for wollacott
0
205
Member Avatar for hallinan

Keep getting an error 'syntax before struct_acc' but cant see where can YOU?! (it's like finding woldo to me) [CODE] void print_customer_statement(char customer[]) { int choice; struct_acc Acc[SIZE]; FILE *file_ptr; int i=0; file_ptr = fopen(customer, "rb"); if (file_ptr == NULL) { printf("Error in Opening files... Program End\n"); exit(1); } while(!feof(file_ptr)) …

Member Avatar for hallinan
0
90
Member Avatar for wollacott

can anyone help me? Write functions to: int isprime(int); /* Returns a true value if a is a prime number */ int nextFib(); /* Returns the next fibonacci value (use static variables to track which one was used last call) */ The fibonacci sequence is defined as: Fib(0)=1 Fib(1)=1 Fib(2)=Fib(1)+Fib(0) …

Member Avatar for DangerDev
0
75
Member Avatar for AMARJEET DUA

I Am Working On A Project Related To Data Compression Using Huffmann Algorithm In C Language..........i Have Generated The Huffmann Codes Using Huffmann Tree.........but The Project Is Yet To Be Completed As I Don`t Know How To Store The Codes In Bits.............i Have Just Learned C. We Have To Submit …

Member Avatar for Narue
0
143
Member Avatar for smiles

Suppose I have a function like that [CODE]char OnRelease() { int i,j,k; int row[4]={PIN_A0,PIN_A1,PIN_A2,PIN_A3}; int col[4]={PIN_D3,PIN_D2,PIN_D1,PIN_D0}; char array[16]={'1','4','7','<','2','5','8','0','3','6','9','>','C','&','E','M'}; set_tris_a(0xff); set_tris_d(0x00); k=0; for(i=0;i<4;i++) { output_d(0xff); output_low(col[i]); for(j=0;j<4;j++) { if(input(row[j])==0) { do { } while(input(row[j])==0); return array[k]; [B][COLOR="Red"]//// will jump out of this function with the value I got ??? [/COLOR][/B] } …

Member Avatar for VernonDozier
0
106
Member Avatar for RexxX

Back to where I was, now I'm learning how to use fgetc properly. Does fgetc read in a character? If so I can't find my error in my code and I'm getting a a segfault. Can you help fix it and explain why it doesn't work? Thanks [code]#include<stdio.h> //declare variables …

Member Avatar for Aia
0
216
Member Avatar for csteverun

I have a program which uses the SDL library. Here is my function which updates the input state: [code] int SDL_UpdateControls () { int qevent = 0; while(SDL_PollEvent(&event)) { qevent = 1; switch(event.type) { case SDL_KEYDOWN: SDL_keydown = event.key.keysym.sym; break; case SDL_KEYUP: SDL_keyup = event.key.keysym.sym; break; case SDL_MOUSEBUTTONDOWN: SDL_mousedown = …

Member Avatar for csteverun
0
170
Member Avatar for jayohn

OK, i found this site because I did a yahoo search to calculate the parking charges and print the total, Well someone else had it already posted but once I registered I lost it. I am not even supposed to be in this class but I have to take it …

Member Avatar for Nick Evan
0
102
Member Avatar for imnolongerhere

my teacher gave me an assignment to complete the blackjack program but I have little understanding of it. I have the majority of it but i'm missing pieces. [B]NOTE: All of the sections where it says TO DO are the missing pieces.[/B] PLEASE HELP. [code=c] #include <stdio.h> #include <stdlib.h> #include …

Member Avatar for WaltP
0
89
Member Avatar for gallantmon1

I need help on how to properly combine two programs into a single program. This is the first program: [code] int main() { FILE *input, *output; char doc; input = fopen("input3.txt","r"); output = fopen("output.txt","w"); while(!feof(input)) { doc=fgetc(input); if(doc==EOF) break; else { if(doc==';') { while(!feof(input)) { doc=fgetc(input); if(doc=='\n') goto out; } …

Member Avatar for Aia
0
117
Member Avatar for Theanthropical

hi,I have a problem here. [CODE=cpp]#include "stdafx.h" int main() { int speed, dist, time, force, mass, masss, accel, velo, moment; int choice, choose; char pilih, pick; do{ printf("\t\t\tWelcome to Physics (Force and Motion)\n"); printf("\t\t***************************************************\n"); printf("\t\t\tCHOOSE SECTION\n\n"); printf("\t1. FORCE\n"); printf("\t2. SPEED\n"); printf("\t3. MOMENTUM\n"); printf("\t4. END\n\n"); printf("Choice: "); scanf("%d", &choice); switch(choice){ case …

Member Avatar for John A
0
198
Member Avatar for T-Mac1

Could someone help me please? I can’t get it to work, and it wouldn’t show me salary in two significant digits for example Enter # of hours worked (-1 to end): [B][COLOR="Red"]41[/COLOR][/B] Enter hourly rate of the worker ($00.00): [COLOR="red"][B]10.00[/B][/COLOR] Salary is [COLOR="red"][B]$415.00[/B][/COLOR] Enter # of hours worked (-1 to …

Member Avatar for Aia
0
132
Member Avatar for sachinvador

I have a text file which has the following format..... 129.2.3.87 18.3.6.77 5655 2333 here the first field is source ip address then destination ip address then source port and destination port there are many such entries..... i want to know how do i extract these fields using c program …

Member Avatar for Aia
0
118
Member Avatar for shrutijadhav

I am looking for a front end/graphical user interface(GUI) in linux which supports C language as backend.

Member Avatar for Duoas
0
150
Member Avatar for T-Mac1

Develop a program that will determine the gross pay for each of several employees. The company pays “straight time” for the first 40 hours worked by each employee and pays “time-and-a-half” for all hours worked in excess of 40 hours. You are given a list of the employees of the …

Member Avatar for VernonDozier
0
904
Member Avatar for RexxX

I'm getting a segmentation fault when I try to run my program. It's probably because I'm not referencing my pointer to a string right, or dereferencing whatever it's called. This is basically what my code looks like. [code] #include <stdio.h> FILE *myFP; char filename[20]; char *pstr = finlename; void func(char …

Member Avatar for Aia
0
109
Member Avatar for Just a beginner

I am writing a calculator program in C. I need a function definition for a function called Subtract() that will allow me to calculate the difference of several numbers entered by the user also need one for division

Member Avatar for John A
0
90
Member Avatar for swetha bandaru

what is meant by generic linked list. how to insert and delete the elements in the linked list which is generic

Member Avatar for Narue
0
392
Member Avatar for gyanu

//I tried to fix the errors but I failed. //pls do it for me....... [code=c] #include<stdio.h> #include<conio.h> void main() { int a; void scanchar(char**); int scans(char**,char*,int,int); int scani(char**,int,int,int,int,int,int); int myscanf(char *); int smyscanf(char*,char*); clrscr(); printf("enter"); myscanf("%d",&a); printf("%d",a); getch(); } static void scanchar(char **str) { extern int getchar(); if (str) { …

Member Avatar for Narue
0
142
Member Avatar for rpjanaka

I am using an open source library called IGI_UDP for measure the available bandwidth of a link ([EMAIL="http://www.cs.cmu.edu/%7Ehnn/igi/"]http://www.cs.cmu.edu/%7Ehnn/igi/[/EMAIL]). with that library they have provided a "Makefile" which is not an auto generated one. the following is the given Makefile, ***************************************************************** CC = gcc INCS = -I. CFLAGS = -g -Wall …

0
65
Member Avatar for neclark2

I've never coded in c before but have to for a class that I'm taking. I'm using miracle c as my compiler but am having a strange error when I try to execute a program. The program executes, but the command window instantly closes so I can't even tell if …

Member Avatar for DangerDev
0
113
Member Avatar for neclark2

For a school project I am doing we are required to take character input through the command line and convert the character to its ascii value. I would think, therefore, that the line of code: printf("%d",(int)argv[1]); would print out 97(ascii for a) if i were to type 'a' as the …

Member Avatar for Aia
0
73

The End.