15,551 Topics
| |
Hi. i need to build an expression tree from a string and i dont get how to do it. for exapmle: str[20]="( (2 + 5) * (8 / 2))"; ![dasd.png](/attachments/small/4/268d6233b4e99809ef2994f89fb1ebcd.png "align-left") can some one help me? thanks. | |
Hello guys can anyone please help me in a problem relating to file. The problem is that I want to use `fgets` on a c file from another c file and increment a the counter every time to get the number of lines and I also want to put the … | |
Hi all, Suppose if I write two programs of same functionality but with different methods and want to measure the run time efficiency how do i know? I mean to say i want to measure the run time of each code how do i do it? Should i check the … | |
pls can i get a code for the following example 1 ** 234 **** 56789 ****** | |
I wrote a program for converting a file from PPM format to ASCII art. Every pixel of the input image is converted to greyscale by calculating the average of red green and blue values ((red + green +blue)/3). The upgrade of the basic version is that I calculate the average … | |
I am very confused with the following thing #include <stdio.h> int main(void) { int array[3]={1,2,3}; int (*p)[3]; p = &array; /* Here p contians address of the array */ return 0; } Here p contains the adddress of the array. I am very confused why *p does not give me … | |
too many new and intermediate users of C attempt to use the command [icode]fflush(stdin)[/icode] to "flush the input buffer". this is patently wrong. the rule is (and click if you don't believe me) : [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351"]NEVER [/URL][URL="http://answers.yahoo.com/question/index?qid=20071013052534AAuxWmW"]USE [/URL][URL="http://www.gidnetwork.com/b-57.html"]"FFLUSH()"[/URL] [URL="http://www.linuxforums.org/forum/linux-programming-scripting/41287-problem-fflush-stdin-function.html"]ON [/URL][URL="http://www.it.usyd.edu.au/~dasymond/mirror/c-faq/stdio/gets_flush2.html"]INPUT [/URL][URL="http://www.cplusplus.com/forum/general/6554/"]STREAMS [/URL][URL="http://c-faq.com/stdio/stdinflush.html"]SUCH [/URL][URL="http://gcc.gnu.org/ml/gcc-help/2009-01/msg00287.html"]AS [/URL][URL="http://www.dreamincode.net/forums/showtopic45833.htm"]"STDIN" [/URL] here is one method of properly … | |
If you have any ideas for a code snippet you'd like to see, please post them here. We can't depend on the snippet writers to come up with all of the ideas, can we? ;) | |
I have joined the thousands who have done it before, and have compared a number of sorting routines. The sorting is done on the same random-integer arrays. No surprises, quicksort wins this simple comparison hands down. There are clever combinations of sorting routines that are faster, like the snippet by … | |
Please I need a complete Dev c compiler with most intersting hearders like the graphics hearder. Or complete method to add them, cause i have added lately and had no good results. I have stormed the net but cant find one. | |
Hello, I'm writing the simple code as below #include <stdio.h> #include <stdlib.h> int main() { FILE *fp; float x,y; int n; int errno = 0; int i; fp=fopen("test_numbers.dat","w"); for(i=1;i<=10;i++) fprintf(fp,"%d %d\n",i,i*i); fclose(fp); fp=fopen("./test_numbers.dat","r"); if(fp==NULL); printf("File cannot be opened\n"); fclose(fp); return 0; } and save it as main.c I'm compiling the … | |
I am sitting in front of a brandnew 27 inch Apple Macintosh running on OS X Yosemite, trying to compile a timed insertion sort from my Windows days. The Xcode app is a sweatheart, but there are some Windows things in the code that cause a problem. This line ... … | |
I am writing a program that reads a fiel and displays the contents in hex values. The problem is that there are some very strange characters in my output. Code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_BUFFER_LEN 512 typedef enum cbool { ctrue = 1, cfalse = 0 } … | |
Hi all, I have implemented a sort of circular buffer in C for embedded system the code is something like this #define BUFFER_LENGTH 25 UINT8_T array[BUFFER_LENGTH]; UINT8_T increment_interrupt; void interrupt(void) { increment_interrupt++; array[increment_interrupt] = data; if(increment_interrupt == 25) increment_interrupt = 0; } UINT8_T g_old_Index_u8=0; UINT8_T g_new_Index_u8=0; void main() { g_old_Index_u8 … | |
Hi. I need help with the following C program: How to print first member of sequence so that condition `|a(n)-a(n-1)|<EPS` is true, where *EPS* is a random input precision (double value). Sequence *a(n)* is given by: `a(n)=(1-1/2!)(1+1/3!)...(1+(1/(n+1)!))` I tried to cancel factorial in the expression `a(n)-a(n-1)=((-1)^n(n+2))/(n+1)!`, but I don't know … | |
*How can one make a program autorun(that is make it begin on the start of the computer like a password program) *What is the best way to start learning windows programming(graphical user interface) | |
Hi Guys, I am trying to create array of 9 strings dynamically in below code snippet but while accessing elements i am getting all the elements null instead of accessing actual element of array.Please suggest. #include<stdlib.h> #include <stdio.h> #include <string.h> int main() { char **arrayofstr; char str[250]={0,}; int i; for … | |
Hello folks, I am having difficulties in an exercise about parallel programming using mpi and socket in C language.Below is the exercise.I would appreciate any help or suggestions Thanks Exercise 5.3: In one of the local network nodes there is a file named FILE = "..." Develop a program using … | |
ok, I just want to note, I understand the basic methods of a struct, but I'd like to understand deeper... how exactly does a struct work on the CPU?? (where and how does it store the code template, how is it called, and what is it stored as) I'm trying … | |
I have the code to show tower of hanoi graphically. It is very hard coded,can anyone help me to remove hard coded sotuation. #include <gtk/gtk.h> #include <stdlib.h> int diskisin [5], posinpeg [5], diskcount [3], width = 655, height = 430, delay = 100000, ysize = 20, kbhit, n; double cl … | |
Hello, day's greet!! I was trying to pass a 3D array. But the following code generate error. Please tell me where am I wrong and why. Thanks a lot !!!! #include<stdio.h> void print_all(int [][][],int,int,int); int main() { int degree=3, row=2, col=3; int arr[3][2][3] = { {1,2,3, 4,5,6 }, {7,8,9, 10,11,12 … | |
hello there, i need a code that takes the values of the array from the user, and see if it is in increasing or decreasing order or non of them. thanks | |
Hello there, I am having a problem with small application. I have used gdb and following error appeared: strlen() segmentation fault. Could anyone help me to find out solution? int main(int argc, char* argv[]){ char* name = malloc(strlen(argv[1])); name = strcpy(name, argv[1]); printf("%s \n", name); return EXIT_SUCCESS; } | |
hai can you please give me in detail how to write a c program for a sensors | |
I wrote this program that get words from user and if it was entered already it will print you loose but when I the first code crashs but the second code works! why the first code is crashs? #include <stdio.h> #include <string.h> int getword(char *word); int find(char * words[], int … | |
Hi, I have this doubt i have read that "We must declare c to be a type big enough to hold any value that getchar returns We can't use char since c must be big enough to hold EOF in addition to any possible char. Therefore we use int." it … | |
I have just started with c programming in school and need alot of help from you guys. For i have alot of questions. | |
Write a computer program in the C language that reads two binary numbers from the standard input (keyboard) and outputs their sum, difference, and product (in binary format) to the standard output (monitor). | |
# we get month for (month=days/30;) years for ( years=month/12;) but we also get days for(( days=days%30, why it happend explain ??)) # |
The End.