15,550 Topics

Member Avatar for
Member Avatar for NotAround

I'm rather new to the C programming language and I'm very stuck. Whenever I try to assign a value to dynamically allocated string, I end up with a Segmentation Fault. Could someone help me by explaining why this happens. Following is a bit of my code that I think should …

Member Avatar for gerard4143
0
135
Member Avatar for halil.burak
Member Avatar for halil.burak
0
133
Member Avatar for yabuki

I created my own header file in C by creating the ff. files: myfile.h, myfile.c and main.c.Afterwards, I compiled myfile.c so I already have the object file for it, but the problem is when I compiled and run main.c this error message appeared: "Undefined symbol _sum". Please help me to …

Member Avatar for xmelx
0
379
Member Avatar for gahhon

i wanna ask about this statement... [CODE]int a[] = {0};[/CODE] the value all of a is it equal to 0 ? i mean all of the location of a..

Member Avatar for halil.burak
0
88
Member Avatar for gaurav_13191

This is my code for drawing a circle using mid point algorithm:- [CODE] //Midpoint circle algorithm #include<graphics.h> #include<stdio.h> #include<conio.h> void drawcircle(int xc,int yc,int r); int main() { int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,"..//bgi"); drawcircle(250,250,10); getch(); return 0; } void drawcircle(int xc,int yc,int r) { int p,x=0,y=r,incr1=2*x+3,incr2=incr1+2-2*y; void drawPixel(int,int,int,int); drawPixel(xc,yc,x,y); p=1-r; while(x<=y) { if(p<0) …

Member Avatar for Adak
0
120
Member Avatar for xcr

Hello all, I hope that someone can help me with this, I am trying to add an element to a dictionary, and in order to do such, I am using a binary search mechanism to find the correct place in the dictionary. My code compiles fine, but when I run …

Member Avatar for Unimportant
0
90
Member Avatar for R3Slick

Ok this is so new to me but does anyone have example code that decodes header fields in an IP datagram? or a link to something like the beej's guide....So i need to decode the header from the following example. 0000000 141724 120662 000002 000004 000000 000000 000000 000000 0000020 …

Member Avatar for Pral
0
3K
Member Avatar for Oakley & Ooijer

can anyone pls help me to solve tis Q? the objective is :To utilize string handling and file handling capabilities in C programming. Task : 1. Develop a program that will receive a single string which shall have a minimum length of 10 characters long. (Hint: Use function called strlen …

Member Avatar for Narue
0
95
Member Avatar for tweetychelz

Imagine a tollbooth at a bridge car passing by the booth is expected to apply a fifty-cent tool. Mostly they do, but sometime a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by and of the total amount of money collected. …

Member Avatar for peter_budo
0
298
Member Avatar for patticus

I'm trying to solve a sudoku checker for a game I'm building in C. Essentially these nested for loops are supposed to check through the smaller boxes of 9 numbers to ensure there are no duplicates. Unfortunately, the continue seems to make the checker not work. :( 123 456 576 …

Member Avatar for thelamb
0
89
Member Avatar for Alerwiali

hi Everyone !! i need help guys with hash table in c ..could anyone help me by a little explaination of how to use hash tables ...please give examples.. Thanks in advance for all.

Member Avatar for Alerwiali
0
131
Member Avatar for diddle

Hi all, Could you tell me how to write simple graphics program in c, for example, how to take the format of bmp, pgm, csd file from image file? how to convert from one format to other? If anybody knows a good book or web site, please tell me soon.

Member Avatar for Ancient Dragon
0
353
Member Avatar for starkz_123

[CODE] #include<stdio.h> #include<math.h> #define min(a,b) (((a)>(b))?(b):(a)) #define abs(a) (((a)>(-(a)))?(a):(-(a))) void convert( int bod, int *x, int *y, int *z ) { int a; int b; int c, str, zb; if( bod==1 ) { *x=0; *y=0; *z=0; return; } a=(bod-2)/6; b=(-1.0+sqrt(1+8*a))/2.0; c=bod-1-3*b*(b+1); ++b; str=(c-1)/b; zb=c-str*b; switch( str ) { case 0: …

Member Avatar for digital29
-1
224
Member Avatar for oggiemc

Hi, Can someone explain to me what is going on in the code below as im new to pointers and not quite sure what is going on..In particular, an explanation of the first couple of iterations in the for loops would be helpfull.. Thanks [code=c] #include<iostream> 5 using namespace std; …

Member Avatar for gerard4143
0
75
Member Avatar for ricardo.crudo

Is necessary deallocate memory of pointer-to-pointer? Example: [CODE] my_type_t **example; example = (my_type_t **) calloc(10, sizeof(my_type_t *)); for (i = 0; i < 10; i++) { example[i] = (my_type_t *) malloc(sizeof(my_type_t)); } // ... free(example); // it enough? // Or is necessary do this... for (i = 0; i < …

Member Avatar for gerard4143
0
85
Member Avatar for xinyonz
Member Avatar for shinichi78
Member Avatar for Narue
0
31
Member Avatar for antikceo

Hi, I have the following code that is meant to serve as a t9 program like the one in mobile phones. It initially loads a dictionary file, stores the values in a dictionary, and prompts the user to enter a string of numbers between 2 and 9. For some reason …

Member Avatar for antikceo
0
1K
Member Avatar for Akulki
Member Avatar for caraie

Hi!, im new in this forum (and programming in c :)) (and sorry, my english is not good enough, I speak spanish) I have a problem trying to release memory from a Matrix structure. When I try to release a square matrix there is no problem, i can do it, …

Member Avatar for Martin B
0
121
Member Avatar for mast3rshan3

Hello everyone, I'm just getting started with C and I need help on this problem. It's a pretty long read so bare with me. [QUOTE]Objectives 1. To reinforce your knowledge of ‘for’ loops and ‘while’ loops 2. To utilize strings (character arrays) in C 3. To implement logic in your …

Member Avatar for NuclearSheep
0
659
Member Avatar for Danny_501

Hi all, Is there a way to make thread pools in POSIX pthreads? (using c) I could only find implementations for java and c++, but I need it to be in c. Thanks.

Member Avatar for gerard4143
0
160
Member Avatar for randyson

i want to do a program to implement time table preparation program using c language.i need some help to how i should write codings,necessary fields.i dont have any idea to start.so i need some examples that i have to compare with that and to try myself

Member Avatar for halil.burak
0
542
Member Avatar for wallace900402

i know how to use fopen to read a file, but i have a changing file name like this "p%dt%03d.state" where the variables are changing inside a loop. eg : p1t001.stae, p1t002.state ... etc how will i be able to do that? thanks!!

Member Avatar for Ancient Dragon
0
41
Member Avatar for angelinrajeesha

Hi, i have the following code not able get the output #include <stdio.h> #include <string.h> #define DELIMITER "," int main() { char *bufferPtr = " \"Angelin\",\"rajeesha\""; char *delimiterPtr =NULL; int parseIndex = 0; char ** fieldarray; fieldarray[parseIndex] = bufferPtr; parseIndex++ ; delimiterPtr = (char *)strstr(bufferPtr, DELIMITER); printf("\n delimiterPtr %s\n",delimiterPtr); bufferPtr …

Member Avatar for Ancient Dragon
0
100
Member Avatar for jay1648

Hi, Please suggest me all possible ways of declaring structures in my C codes. I want to be able to create a structure which I can use in my methods without have to use the keyword "struct" each time to declare it. One way I already know of is : …

Member Avatar for hyperion
0
186
Member Avatar for XMasterrrr

like the thread title said i need the best C book for never programmed person can you please tell me it thanks....

Member Avatar for XMasterrrr
0
163
Member Avatar for dragonpunch

Hello im confused with pointers, how do i create a shallow copy of a string array in c ? [CODE]char *currMenuArray; // ??? char *MainMenuArray[] = { "MAIN MENU", "One", "Two", "Options", "Quit" }; char *OptionsMenuArray[] = { "OPTION MENU", "Option1", "Option2", "Option3", "Back" }; void main() { currMenuArray = …

Member Avatar for Narue
0
406
Member Avatar for duanz_88

can you help me to answer this problem... A high building has 26 floors with the level 0 and the level 25 as the lowest and the highest level, respectively. It has a lift for transport the occupant to the level destination. The lift moves up and down in respect …

Member Avatar for sree_ec
0
2K
Member Avatar for gagan bhagat

The End.