15,550 Topics

Member Avatar for
Member Avatar for Clearner123

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 …

Member Avatar for Mayukh_1
0
326
Member Avatar for Ku Nj

pls can i get a code for the following example 1 ** 234 **** 56789 ******

Member Avatar for Mayukh_1
0
189
Member Avatar for newprogramming

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 …

Member Avatar for rubberman
0
406
Member Avatar for dbfud1988

Where can I find programming contest problem or solution problem

Member Avatar for dbfud1988
0
85
Member Avatar for Clearner123

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 …

Member Avatar for Clearner123
0
169
Member Avatar for jephthah

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 …

Member Avatar for David_50
0
6K
Member Avatar for deceptikon

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? ;)

Member Avatar for vegaseat
3
739
Member Avatar for vegaseat

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 …

Member Avatar for vegaseat
2
249
Member Avatar for Fon_1

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.

Member Avatar for vegaseat
0
130
Member Avatar for Dimitris_1

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 …

Member Avatar for vegaseat
0
158
Member Avatar for vegaseat

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 ... …

Member Avatar for vegaseat
0
265
Member Avatar for CodeWarrior14

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 } …

Member Avatar for Dervish1
0
3K
Member Avatar for Clearner123

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 …

Member Avatar for gusano79
0
142
Member Avatar for negru

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 …

0
100
Member Avatar for Fon_1

*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)

Member Avatar for Moschops
0
213
Member Avatar for can-mohan

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 …

Member Avatar for deceptikon
0
208
Member Avatar for ervinmalkaj

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 …

Member Avatar for rubberman
0
275
Member Avatar for Tcll

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 …

Member Avatar for Tcll
0
154
Member Avatar for oenwings

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 …

0
85
Member Avatar for ram619

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 …

Member Avatar for ram619
0
216
Member Avatar for Mohammed_23

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

0
109
Member Avatar for Bartosz

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; }

Member Avatar for Bartosz
0
3K
Member Avatar for durgaBHAVANI

hai can you please give me in detail how to write a c program for a sensors

Member Avatar for vegaseat
0
2K
Member Avatar for Habib_7

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 …

Member Avatar for David W
0
329
Member Avatar for Clearner123

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 …

Member Avatar for Clearner123
0
130
Member Avatar for Naagieh

I have just started with c programming in school and need alot of help from you guys. For i have alot of questions.

Member Avatar for rubberman
0
35
Member Avatar for Mike_24

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).

Member Avatar for ddanbe
0
58
Member Avatar for hadisur_rahman

# 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 ??)) #

Member Avatar for ShiftLeft
-1
887
Member Avatar for brandon66

Hey everyone, i've got myself stuck on a problem of determining a winner. While doing a battle if a player runs out of cards it will use the last card(card that started the battle). I cant seem to get all the bugs out of it; and i think im overlooking …

Member Avatar for brandon66
-1
292
Member Avatar for Andrey_4

Authors of PVS-Studio static code analyzers offer programmers to test their sight and to try finding errors in C/C++ code fragments: https://software.intel.com/en-us/blogs/2015/04/24/lets-play-a-game-find-bugs-in-popular-open-source-projects

Member Avatar for Suzie999
0
198

The End.