15,552 Topics

Member Avatar for
Member Avatar for GyanPP

Hello, 1) I am trying to run gprof on the following code snippet: [CODE]int fc() { while (1); return 1; } int main () { fc (); return 1; }[/CODE] 2) compile: gcc -pg tmp.c 3) Execute gprof -a a.out 4) Fails with the following error: gmon.out: No such file …

Member Avatar for Nick Evan
0
58
Member Avatar for lotrgandalf

Is there a straight way to compare variables from 2 different C programs in Visual Studio? The only way of variable comparison I can come up with is writing them to the disk using file handling and then comparing them using a third program. Does Visual Studio allow variables to …

Member Avatar for gerard4143
0
97
Member Avatar for COKEDUDE

Can someone please explain why "#include <stdlib.h>" fixes "warning: implicit declaration of function". Also what does #include <stdlib.h> mean and when should you use it?

Member Avatar for Banfa
0
216
Member Avatar for BestJewSinceJC

How can I create a semaphore using the above functions that will allow [I]any[/I] process access to the semaphore? I've been playing around with global variables for hours thinking I was doing it wrong, but now I believe I was misled. I think the problem is that the other processes …

0
77
Member Avatar for R3Slick

Hello everyone, I'm having trouble with a code I need to write, I have never coded in C and I need to do this program in C. I have created my checksum code already and need to implement this: I need to send a complete ASCII file in 128 byte …

Member Avatar for R3Slick
0
205
Member Avatar for sgriffin

Hey everyone, I am a brand new member and thought I could learn and get some help at the same time. I have an assignment that implements SECDED on a 16 bit word, storing the 5 checked bits and 1 parity bit in the upper 6 bits (makes a 22-bit …

Member Avatar for sgriffin
0
348
Member Avatar for urbangeek

[CODE]#include<stdio.h> #define sqrt(x) x*x int main(){ int x=5; int y=sqrt(x+1); printf("%d\n",y); return 0; } [/CODE] The answer is 11. Can anyone explain why? thanks

Member Avatar for urbangeek
0
87
Member Avatar for phin

I need help with writing a code that can count the number of functions and member functions per class! Please!

Member Avatar for Salem
0
95
Member Avatar for jeffhorton1965

In the following code I am calling a function from a pthread: [CODE]pthread_create(&threads[t], NULL, dnssearch, (void *)buffer)[/CODE] I need to pass the string (buffer) to a function and the have the function pass a string back. What am I doing wrong in the function: [CODE]void *dnssearch (void *buf) { char …

Member Avatar for jeffhorton1965
0
200
Member Avatar for rontab68

Hi, If I want to pass values of one array to another array, is this the proper code implementation. any alternative or suggestions Thanks. . . . for ( i=0; i<9; i++) for (j =0; j<9; j++){ receive[i][j]=transmit[i][j]; } . . .

Member Avatar for kvprajapati
0
106
Member Avatar for tquiva

Can someone please help me with this program? My goal is to create a test driver for the function put_result(). The program compiles and works as intended. However, I came across a bug that I am having an extremely difficult time trying to fix. I tested for several inputs and …

Member Avatar for tquiva
1
226
Member Avatar for ShortYute

[CODE]char **makeString ( const int numOfArrays, const int sizeOfEachArray ) { /* Function to create an array of strings: ( Array of pointers to strings ) */ /* Local variables */ int i, j; //int numOfArrays = 6; /*char stringsToCopy[6][12] = {"Hello", "Good-Bye!", "Greetings", "Pointers", "Arrays", "Programming"}; */ char **stringArray …

Member Avatar for ShortYute
0
159
Member Avatar for popcorn99

I wrote a simple echo program, which reads standard input character-by-character and then prints it to standard output character-by-character. [code] #include <stdio.h> int main() { int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } [/code] I was expecting it to break out of the while …

Member Avatar for jephthah
0
139
Member Avatar for tedsu

I am trying to print out the number of occurences for each alphabetic chracter in a file that our instructor provided us with. The values range from 1 to 999. I'm trying to print out "count[...] : " followed by the character. So far my counts are correct. However, at …

Member Avatar for Banfa
0
224
Member Avatar for Griff0527

I just started this program a few hours ago, and I am running into an error that I do not understand. I tried finding an answer on Google as well. First off, this is the bare bones of a code right now. I have not started any of the sub-functions …

Member Avatar for Griff0527
0
136
Member Avatar for R3Slick

does someone know a code in c that will send a complete ASCII file in 128 byte packets to another file? So The sender takes the ASCII file as input and sends a 128 byte packet on the data queue

Member Avatar for R3Slick
0
193
Member Avatar for thomasekugm

I am writing a small algebra io program for an intro to c class and i am stuck. The idea is to get the user to input (a * b) + (c / d) + (e % f), in exactly the same format as you see it with the exception …

Member Avatar for jephthah
0
228
Member Avatar for Griff0527

Ok, I have read several other questions basically asking the same thing, but I know this code can work instead of using other peoples work. Yes, i'm stubborn. I have written a function to be called from my main program and i keep getting an error that I cannot figure …

Member Avatar for jephthah
0
769
Member Avatar for msaqib

This is an automated system for Bank Management. It uses files to handle the daily transactions, account management and user management. Nice graphical layout and mouse functionality. Manager can add, edit and delete the users and manage the user accounts. Code From: <URL SNIPPED>

Member Avatar for jephthah
-2
313
Member Avatar for nunos

I need help with debugging this piece of code. I know the problem is in malloc and free but can't find exactly where, why and how to fix it. Thanks. [CODE] #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> #include <string.h> #include <sys/wait.h> #include <sys/types.h> #define MAX_COMMAND_LENGTH 256 #define MAX_ARGS_NUMBER …

Member Avatar for nunos
0
173
Member Avatar for yasy

Write a function called nRandomNumbers( ) to performing the following: • Generates N random integers between -250 and 250 (inclusive) and save them in a file called number.txt, (Use the function srand()). • Prints all the generated integers. • Finds the average of all the negative integers, and the maximum …

Member Avatar for Adak
0
107
Member Avatar for Idontknowc

I'm currently trying to create a code in Cygwin using pure C to display ASCII control characters that may be present in the text file in a ASCII control characters non-printable form. I can call to a text file to display its contents but in normal ASCII characters but I …

Member Avatar for Ancient Dragon
0
321
Member Avatar for oggiemc

Hi everyone, Ive been asked to do an assignment to test the randomness of a linear congruential generator..We've been given the code implemented in c..the problem is i dont really see how this code relates to the theoretical LCG equation i.e X[n+1] = (aX[n] + c) mod m..So i would …

Member Avatar for invisal
2
1K
Member Avatar for Ammar1990

Hi All, I am new to C language and am suppose to write a program that gives me an even integer with cube greater than 40000 and also is divisible by 7. This is what i have... [CODE]#include <stdio.h> #include <stdlib.h> #include <math.h> int main(){ float a,b,c,d,e; a=pow(40000,1/3); while(pow(40000,1/3)<=a){ a=b; …

Member Avatar for Adak
0
116
Member Avatar for vladdy19

I'm having trouble running C in eclipse. It first gives me weird syntax errors or tells me that # include <stdio.h> is an "Unresolved inclusion" It also will not let me build, saying "(Cannot run program "make": Launching failed)" Am I missing something? please help. Thanks

Member Avatar for lmpmbernardo
-1
805
Member Avatar for hosam2k

hi all do anyone understand hash function? how to use it in order i can count a digit number of size 10? then i separated it half half (into 5 digits each) :)

Member Avatar for hosam2k
0
146
Member Avatar for manjotpahwa

//*************************SERIOUS PROBLEM, NOT WORKING****************** [CODE]//DOUBLY LINKED LIST #include<stdio.h> #include<stdlib.h> struct dll { int info; struct dll *next; struct dll *prev; }; struct dll *head = NULL, *tail = NULL, *temp; void append(); void insafter(); void delete(); void display(); void main() { int choice; do { printf("Enter your choice:\n"); printf("1.Append Node\n2.Insert …

Member Avatar for jephthah
0
155
Member Avatar for Muhammadlodhi

[CODE]int main(){ char i,input[30],close,open; for(i=0;i<='.';i++){ printf("enter equation"); scanf("%c",input[i]); if(input[i]=='(') input++; input[i]=open; else if(input[i]==')') input[i]--; input[i]=close; else if(open[i]==close[i]) { printf("paranthesis are balance"); } else printf("paranthesis are not balance"); } getch(); return 0; }[/CODE]

Member Avatar for jephthah
-2
112
Member Avatar for jeffhorton1965

Help please.. I need some help in C to open a file and search for a string. If the string is found then move one space and copy the next string to end-of-line back to buffer. I am creating a program using pthreads and need to search this file in …

Member Avatar for jeffhorton1965
0
143
Member Avatar for Muhammadlodhi

i want to write this program without lib and string files make changes in it and tell me the program thanks code is below[CODE]#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct Node; typedef struct Node * PtrToNode; struct Node { char element; PtrToNode Next; }; PtrToNode MakeEmpty(PtrToNode L) { L= new(Node); L->Next=NULL; return …

Member Avatar for Muhammadlodhi
0
120

The End.