15,551 Topics

Member Avatar for
Member Avatar for btml

hi :) i managed to compile it but when i try it - it scream Segmentation-Fault. i have no idea where it happens exactly . only know that it happen :( can someone help me ? thanks in advance the program try to implement some kind of hash table : …

Member Avatar for Banfa
0
170
Member Avatar for omGac0W

Hi I'm REALLY new at C and am getting this "constant out of range in comparison error". The line with the error is this: [CODE]printf("Would you like you enter additional sets of data? (yes/no)"); scanf("%c", &answer); while( answer == 'yes'); <------ this line [/CODE] I haven't done character strings in …

Member Avatar for Banfa
0
1K
Member Avatar for nshh

Hi, Please answer the below questions....thanks 1) How can I free the memory from main(). But the memory was allocated in function a(). void a() { char *b=malloc(10); } main() { a(); } 2) How can I return the local pointer variable? main() { char *a=result(); } char * result() …

Member Avatar for Radical Edward
0
131
Member Avatar for fpsasm

Hello, I am using strncpy to copy the first line of a multi-line buffer. I have successfully found the amount of characters to the end of the first line, and I have performed a strncpy to copy the first line of the buffer to a char *. However, some of …

Member Avatar for fpsasm
0
169
Member Avatar for ryan461

I've got this exercise from a book that wants me to program two rolling dice, add the value of the dice to together and basically track each time a number is rolled. So ive got an array with 11 spots for the numbers 2 - 12. Whats not working in …

Member Avatar for ryan461
0
109
Member Avatar for mick3339

I am trying to implement an expert system in C. I have written each rule in the expert system as a function. However, I want my system to be more flexible and can process these rules from an external file specified at run time rather than hard-coded. This will provide …

Member Avatar for gusano79
0
708
Member Avatar for tskellyfla

Hello again, YOu guys have been such a big help in helping me understand what I'm doing wrong in my programs I'm hoping that I can get help again. I am currently writing a code in C. I'm supposed to be writing a code that has the Fibonacci Series up …

Member Avatar for tesuji
0
103
Member Avatar for urbangeek

hi guys, can't understand why the answer of the following program is 7? Please explain.. [CODE]#include <stdio.h> #define SQ(x) x*x int main() { int a,b; a=5; b=-SQ(a+2); printf("%d",b); return 0; } [/CODE] thank you..

Member Avatar for urbangeek
0
159
Member Avatar for rohit83.ken
Member Avatar for Alfarata

I need to read in a csv file created by MSExcel into an array. The file contains 750 rows of 5 sets of numbers some int. some float. the format looks like this: 301,36,0.285,2.88,15.000 302,88,0.247,2.88,75.500 How do I read this data in a 'C' program without the commas, and then …

Member Avatar for sinju
0
149
Member Avatar for Ferny84

I am stuck on this program that I am supposed to create. It has to ask the user for a text file where the format looks like: MATH 101 GEOLOGY 101 GYM 101 Then i'm supposed to store the information from the file in an array which then gets pointed …

Member Avatar for Ferny84
0
89
Member Avatar for johndoe444

I have say a loop. At the beginning of the loop I want to fill a very large array which is an array of structures. Is there way like memcpy to fill the array without going through for loop. I figure using memcpy instead of for loop would be a …

Member Avatar for johndoe444
0
167
Member Avatar for Fasola

First how do you use Dynamic and Static Memory Allocation? and why is supposed to be so popular in use?

Member Avatar for umair100
1
139
Member Avatar for atman

Hello, I have a a problem copying individual words inside 2D array. Array is dynamically created and initializes perfectly, but as soon as i call my function, and if i have 2 or more spaces between the words, its copying the spaces inside the next index element of the array. …

Member Avatar for Ancient Dragon
0
120
Member Avatar for mjoshi

I have a code which throws "segmentation fault" after some computation. I was looking for some help with efficient memory management. My program does the following: I have a grid with min. i,j,k coordinates -52, -34, -35 and max. i,j,k coordinates 53, 37, 33. (In i, j, k loop). I …

Member Avatar for arld101
0
132
Member Avatar for danarmstrong

I have a servlet written in Java and I am attempting to send data to the method using C and the WinSock2 API. When I attempt to just send the raw data I get an invalid stream header error. I am not sure how I should go about handling this …

Member Avatar for niyujin
0
79
Member Avatar for bobyx

Hello,everybody.Would you please describe me about the differences between the(|=) ,(^= ) operators?Is it possible to use(&=)instead of the above two assignments and how? Thanks,[code]Assignment,compound operators;[ |=,^= and &=][/code]

Member Avatar for bobyx
0
140
Member Avatar for Bluefox815

I was writing a program and wanted to write a struct that's used to match an input string and print a corresponding output. However, I ran into a very unexpected problem. This code gave me the compile error below. [code] #ifndef MATCH_H #define MATCH_H #define TOTAL_WORD_PAIRS 2 typedef struct { …

Member Avatar for Bluefox815
0
276
Member Avatar for cokaznsyco72

Does anyone know how to do file input and output with spreadsheets? Specifically I'm going to be using the open office spreadsheet. thanks

Member Avatar for cokaznsyco72
0
107
Member Avatar for eslmz

I use a non english keyboard and i'm writing a console program. When i want to check a non english character with using getch, it returns wrong ASCII values(it gives the same number for different characters). But when i try to use getchar, it returns the true ASCII numbers. But …

0
39
Member Avatar for tennis
Member Avatar for HappyTron

Hello Guys, I am trying to read lines from .xml file using a C program. Basically what program does is read the date, and if the current system date is in the range of the date range given, it fetches some data from the next lines in the date. However,my …

Member Avatar for Bluefox815
0
148
Member Avatar for mcodesmart

Hello, Please see the code below. it combines 2 strings into one. [code=c] #include<stdio.h> #include <string.h> int main() { char a[10], b[10], *p = NULL, *combine(char *s, char *t); strcpy(a, "horse"); strcpy(b, "fly"); p = combine(a,b); printf("%s\n",a); printf("%s\n",b); printf("%s",p); } char *combine(char *s, char *t) { int x,y; char r[50]; …

Member Avatar for Bluefox815
0
194
Member Avatar for icewolf

Hello. I'm trying to find out how to make it so only certain applications I have given authorisation to can use a C DLL I have created so that when I release it with a .Net application it cannot be used by others. I found out how to check what …

Member Avatar for Bluefox815
0
183
Member Avatar for Anex

I am facing some problems trying to understand the difference in handling strings when they are declared as a char array and when they are declared with a pointer pointing to them. In the following code snippets, I have a few doubts. 1.While code 1 works correctly, code 2 crashes …

Member Avatar for Ancient Dragon
0
113
Member Avatar for amen

how to check there exist number in string using isalpha.if number exist, display "only alphabetic,please input again" example : user input = i had to 2 number

Member Avatar for Ancient Dragon
0
152
Member Avatar for tomtetlaw

When I run my code, I get "Run-Time Check Failure #2 - Stack around the variable 'string' was corrupted." I have looked everywhere in my code for a source of this error, and I can't find one, I've also looked where a buffer overrun could occur. The variable string is …

Member Avatar for tomtetlaw
0
161
Member Avatar for FierceLeming

Alright, the issue I'm having is figuring out whether or not I'm causing memory leaks. I'm considering three situations which might or might not be the same: 1) If I declare a variable in a block of code as a character array, I'm making a pointer to it. But when …

Member Avatar for Radical Edward
0
141
Member Avatar for vishalkhialani

Hello, I am saving my data in a text file. I can successfully access my file and add records in it and even search it. but when it comes to del a record i dont know how to do it. Can some one please advice. Regards, Vishal

Member Avatar for 1988Rhythm
0
180
Member Avatar for ramy89

Hello to everyone,I'm using a Borland BCC55 compiler to describe the logarithm function. It works fine,but only with numbers higher than 1,if I insert any floating point the result stucks on -46,whatacer number <1 I write. Here is the function,I made it myself (on a text host): [url]http://freetexthost.com/kv0rdi4gno[/url] Of course …

Member Avatar for ramy89
0
110

The End.