15,551 Topics
| |
Hi, I'm writing a small C program to clean the radius radacct table, removing ended sessions records and inserting on a separated database. The problem is that MySQL C API doesn't have an easy way to insert the result of a query on another database/table directly, you have to build … | |
Hi. Can you help me read a two digit like "12" from an input.txt file, is it advisable to use fscanf or fgets? This is a sample of the txt file : a(1,4,3,12,15) Thanks :) | |
#include <stdio.h> #include <stdlib.h> #include<string.h> char combine(char [],int k,int n); int main() { char str[10]; int m,n; printf("enter the string: "); fgets(str,sizeof(str),stdin); m=0; n=strlen(str); printf("the combinations are....\n"); combine(str,m,n-1); return 0; } char combine(char a[],int k,int n) { int i; char temp[40],t; strcpy(temp,a); if(k==n) { printf("%s\t",a); } else{ for(i=k;i<=n;i++) { t=a[k]; … | |
I have written some code that stores values inside a array of arrays. I am releasing the memory in my release method but Valgrind still reports the following: ==640== ==640== HEAP SUMMARY: ==640== in use at exit: 6,094 bytes in 33 blocks ==640== total heap usage: 12,040 allocs, 12,007 frees, … | |
Hi guys, I'm having a weird error that I can't understand why: My program is the following: int paralelo(int num) { int cont,pid; printf("Creating %d sons with pid\n", num); for(cont=0;cont<num;cont++) { pid=fork(); if(pid==0) { printf("I'm the son number %d e %d\n", cont, getpid()); exit(0); } } return(0); } int main(int … | |
my problem is that i have written an algorihtm to convert non deterministic finite automata to deterministic finite automata but i couldn't translate it to C program and this is the algorithm i have written qx is a state in the NFA and q0 is its start state QX is … | |
To convert integer no to roman number . .where integer is within 5000 | |
Spiltter function split the sample.c program into 3 parts sample.dat.1 sample.dat.2 sample.dat.3 if its memory size is 300 and splited file wil hav 100 respectively . . And join function is opposite of it. . Its in unix example split -c <size> filename for join join file | |
#include <stdio.h> #include <stdlib.h> int i=-1; main() { int a[30],n; printf("enter the no of terms: "); scanf("%d",&n); store(a,n); } int store(int a[],int y); { if(i==y) { return \\it should return and terminate exit(0); } i++; printf("enter the number: "); scanf("%d",&a{i]); store(a,y); i know i had made a mistake but where … | |
| |
` #include<stdio.h> main() { int b,c; printf("enter c :"); scanf("%d",&c); printf("enter b :"); scanf("%d",&b); printf("%d", gem()); getch(); return 0; } int gem(int b,int c) { int a; a=b+c; return a; } ` | |
#include<stdio.h> #include<conio.h> #include<stdlib.h> main() { char ch1[20],ch2[20],*temp[10]; int i,j,count,k,p,q,len1,len2; printf("Enter the string\n"); scanf("%s",ch1); printf("Enter the string to be found\n"); scanf("%s",ch2); for(i=0;ch1[i]!='\0';i++); len1=i; for(j=0;ch2[j]!='\0';j++); len2=j; k=0; count=0; for(i=0;i<len1;i++) { if(ch1[i]==ch2[0]) { temp = &ch1[i]; k++; } } for(i=0;i<k;i++) { for(p=0;p<len1;p++) { for(q=0;q<k;q++) { if(*ch1[p]==*temp[q]) { for(j=0;j<len2;j++) { if(ch2[j]==ch1[p]) p++; if(ch2[j+1]=='\0') { … | |
a simple question, i just can't get around at the moment - if i may if unsigned char *s = 42006f, how can I split/select the hex value into its pairs i.e 42/00/6f using portable ansi c. thanks!! | |
hi i am making a Bcd to Binary conversion can somebody help me lessen the code? thanks. //! Converts a two-byte, 3-digit, BCD number into a binary value. extern uint16_t BcdBin( const uint8_t* const pBcdBin); //uint16_t BcdBin(const uint8_t * const pBcdBin) int main() { int Num; int A=0,B=0,C,D,E=1; int F[100]; … | |
Hello all! I have used this forum many times in the past to solve a variety of programming related problems, but am truly stumped on a segfault within a binary search tree. I have isolated the segfault to a fscanf statement that look legitamate to me. The following code blocks … | |
| I request every body on DAniweb.com that please , if any body knows about segment tree, then please either explain me it's update, making otherwise give me solid links so that i can learn from there. IT'S REALLY PATHETIC SITUATION AS I AM NOT GETTING THIS FROM WEEKS. PLEASE IT'S … |
Can someone help me complete my code? I am having trouble with it and I need some input. //#include "bigint.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> /* Create and implement a bigint data structure that can represent integers whose size is limited only by the memory capacity of … | |
Hello I need to do it in ansi c Can't seem to get it to work at the moment. unsigned char *s scanf("%x", &s); I then want to do if statements based on the amount of characters contained in the variable s. Whats the easiest way to get this? An … | |
Hi everyone well currently I am working on a simple malloc and free implementation but I am facing some problems . I get a segmentation fault this is my output inserting node 0 0xc87000 inserting node 1 0xc87014 inserting node 2 0xc87028 inserting node 3 0xc8703c inserting node 4 0xc87050 … | |
Hello, I've a file which contains names and grades of students, and I'd like to write a program which can sort their grades (like midterm 1,midterm 2) according to user choice. I wrote as far as the choice part and opening the file, yet I don't know how to make … | |
Can I use semaphore or mutex on MikroC? If you know , please tell me the function name or exsample code. | |
Hi guys, I'm learning C and I still don't have some concepts very clear in my mind. I have to create a program that get the values from ARGV[] and puts into a vector: the program would work like that: ./program file1 file2 file3 My idea was to do something … | |
Hello everyone, I stumbled upon a video about the monty hall problem, which I found very well explained, and a lot of comments below the video that were against the conclusion that it **is better to switch**. To clarify, I wrote this small program that simulates the game and allows … | |
int n; scanf("%d\n", &n); printf("you typed %d\n", n); it seems to hang until I type one extra line of input....Can anyone explain this behaviour | |
struct node { int info; node *left,*right; }; int main() { struct node *root; root = (struct node*)malloc(sizeof(struct node)); root->info=NULL; root->left=NULL; root->right=NULL; if(root==NULL) printf("%d",root->info); return 0; } why it doesnt print root->info? | |
Develop a program to meet the following requirements: 1. Must use at least two functions, not including Main 2. Must use indirection (the * operator) 3. Must use a loop 4. Must use an array to hold the integers 5. Must take the integer inputs from a file Your assignment … | |
| Can you please give me link for this tree ? I have searched alot and alot , but i am not getting how to implement it or how to use it. please give me links. it's a request to all of you. thanks. |
#include <stdio.h> main() { FILE*fp ; if ((fp = fopen("new.txt","r")) == NULL); { printf("file could not be opened\n"); return 0; } } this is what ive written and it always comes back with file could not be opened. I need to read the text file new, which has 10 variables … | |
I have the code below #include <stdio.h> int main(){ float n; scanf("%f",&n); printf("%f",n); return 0; } Then, I run the code input: 45321.56 is not same with output:45321.558594 I want to get output which same as the input. How to solve this problem? Thank you | |
How can i give an icon to the exe file produced after executing my code?? is it possible?? |
The End.