15,551 Topics
| |
Hello.Got a problem with a binary tree again,i have made a visual printing but the problem is that it prints only completed tree,so if it is not full it crashes,is there a posibillity to add some extra print to value NULL,so after one right or left leave won't have value(NULL) … | |
How can we convert a string to int without a standard lib the string termination can be '/r' | |
i need help with merge sort. struct List_A { int data; struct List_A *next; }; struct List_A *head; void merge_sort(struct List_A *); int main(void) { ....lets say i have a list build --- (list_A = 4,3,2,5) merge_sort(List_A); } void merge_sort(struct List_A *head) { struct List_A *cur_one; struct List_A *cur_two; if(head … | |
Hi all, Having a little trouble with assigning values to an array within a C struct. Unfortunately i cannot assign a size to the array as i am reading values to an array to be stored, and the size is relative to the other values in the struct passed to … | |
how do you insert in linked list. this is that i have. struct node { int data; struct node *next; }; struct node *head; void insert(struct node*, char*, int); int main() { int data; struct node *List_A = NULL; insert(&List_A, %data); return 0; } void insert(struct List_A, int data) { … | |
I was trying to assign values from a txt file to my program with the following code: #include<stdio.h> #include<conio.h> #include<string.h> int main() { float c1, c2, c3, c4, c5, c6, c7, c8; char d1[4], d2[4], d3[4], d4[4], d5[4], d6[4], d7[4], d8[4]; FILE *rate; rate=fopen("rates.txt", "r+"); fscanf(rate, "%s%f%s%f%s%f%s%f%s%f%s%f%s%f%s%f", &d1, &c1, &d2, … | |
Can someone guide me how can I use scanf for a structure? [CODE]const int IDLEN = 30; const int POLARITYLEN = 3; const int MAXSTOCKITEMS = 10; struct TransistorRec { char manufacturersID[IDLEN]; char polarity[POLARITYLEN]; float power; float gain; int stock; }; typedef struct TransistorRec Transistor; struct StockRec{ int size; Transistor … | |
Can someone help me make a code for a username and password program where the usernameand pass is stored in a txt file. I've tried many things but I still can't make it work. The text file in question has the username password and user type separated by tabs and … | |
Help me please to find the problem in my code: Here is the error that I'm getting: serg@serg-PORTEGE-Z835:~/c$ gcc string_finder.c -o string_finder string_finder.c:4:5: error: conflicting types for ‘getline’ /usr/include/stdio.h:671:20: note: previous declaration of ‘getline’ was here string_finder.c:22:5: error: conflicting types for ‘getline’ /usr/include/stdio.h:671:20: note: previous declaration of ‘getline’ was here … | |
I'm looking for feedback on my code. I wrote a custom memory allocator (out of pure boredom) that is faster than the STD one (malloc, free). It's pretty simple in the way it works, it has a base block of memory which is where everything is allocated from, and it … | |
Hi friends! I'm new to libcurl programming in C. I cant find any libcurl tutorial on the web.Also i tried [the official one](http://curl.haxx.se/libcurl/c/) but i cant understand it because its not elaborate. So please help me with the tutorials/resources on libcurl programming in C. Thank you. | |
hi guys!! The purpose of the program I am trying to do is to have an input number of 6 digits typed in and this should then be printed as an hour minute second format. for example 123456 would be 12:34:56 This is what I have but it isn't working … | |
actually, i don't know where to post this thread. but i know the people available on daniweb.com have much knowledge. will you please tell me that how to start writing proposal. i have spend 2 full days on PC reading about G-SOC but still i am not getting how to … | |
les say we have a binary file. and 1st letter is 3. how do i take 3 and put it into a char ar[]. what i did was if(fread(ar, 1, 1, fine)) { } | |
The problem I have and can't understand is that I receive a segfault when trying to close the second file (fclose(ofp)). Input file is a xml file that will generate food for output file. At present time, input file is being read for parsing but no output for outfile is … | |
actually, i want to calculate 2^60000 in 1 second. i have tried a way but it is giving output in specified time for 1000 power only.(i have used arrays to store a one integer). will you please give me a hint only how to do that ? [B][I][U]"I AM NOT … | |
Why is it that this won't work instead of using atoi ? `Inline Code Example Here` #include<stdio.h> int main(void) { printf("%d",(int)"10"); return 0; } | |
char *ar[5]; //Array of pointers let say char * ar[5] contain: ar[0] = "cat"; ar[1] = "desk"; ar[2] = "desk" ar[3] = "zoo"; ar[4] = "cat"; how i want to get of any same strings. so in end ar should have the value "cat","desk","zoo". this is what i have so … | |
I am working on a recursive flood-fill function with 4-connected neighbours as part of a drawing application program. However, my attempts keep resulting in the program crashing. I am coding in C, however I will just post pseudo-code of my algorithm. I am hoping somebody can help me see what … | |
hi, i have a small problem with my program: int main(int argc, char *argv[]) { int ende; int modus; short x; short y; mkdir("maps"); while(1==1) { cls(); //some printf's char enter=0; while (enter != '\r' && enter != '\n') { enter = getchar(); } system("cls"); ende=0; modus=0; //some printf's scanf("%d",&modus);fflush(stdin); … | |
hello, i wanna ask if somebody can help me with this problem. First code: #include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]){ if(argc>1) { int i=1, zmnozek=1; zmnozek=atoi(argv[1]); for(i=1; i<argc; i++) { zmnozek*=atoi(argv[i]); }; printf("Rezultat: %d\n",zmnozek); }else { printf("Nepravilen vnos!\n"); }; return 0; } And there is the problem: … | |
Can someone please answer this for me as i cant do this practice question Thank You. ![Untitled56](/attachments/large/3/Untitled56.png "Untitled56") | |
I have been trying to explore the source code of the getcontext() and setcontext functions but I have not been able to spot the right file or resource. Any help in this regard will be helpful. I was able to trace to http://fossies.org/dox/glibc-2.14.1/setcontext_8c_source.html but there is no info | |
[CODE] #include <iostream> #include <string.h> #include <ctype.h> using namespace std; void RemoveSpaces (char *str); void Removevowels (char *str); int main() { system("Color 1A"); char myString[300]; char clear[300]; char cipher[300]; int selection; int x = 0; int i = 0; int opt; cout<<"Enter a string!"<<endl; cin.ignore(); cin.getline(myString,sizeof(myString)); cout<<"Plase select what you … | |
Is it possible to convert Float or double in a string??? Any idea?? | |
Hi, I want to know what is meant by a code footprint. I tried googling but all of them have explanations that I was really not able to understand. Can anyone please tell me what is means? How is it important and how can it be used(if at all it … | |
Hi there, I've been learning C lately, and in one of the exercises I've encountered a bit of a frustrating issue. The exercise is to accept a string of characters that are answers to a multiple choice quiz, and then compare them to the correct answers which are in another … | |
Hey, how do you declare an array of strings using double pointer ? I normally use [CODE]char* str[] = {"this", "works", "fine" ,"for", "me"}; [/CODE] But I want to know if there is a way of declaring array of strings using something like [CODE]char** str; [/CODE] Please show me how … | |
Hi. Sooner or later I had to go into the depths of C. Today was the day I tried my first things with C. However, I am having a problem although I do not know what actually causes it. The goal of the pogram is to combine the parameters into … | |
Here's a small snippet from my code. Following a Knuth Shuffle model in the Shuffle function, I get 6 Pointer Expected errors in line 15, but I'm sure its really 2 due to the SWAP function in the header. Now the two things I'm swapping are a random index and … |
The End.