15,551 Topics

Member Avatar for
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
160
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
142
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
242
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
141
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
197
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
231
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
775
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
318
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
174
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
111
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
323
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
119
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
814
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
152
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
156
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
116
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
148
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
123
Member Avatar for adrawat

Hi, I have a file in C which has many lines. I want to store each line separately so that i can reference it later with a char *host. How can i do that? Thanks.

Member Avatar for WaltP
0
300
Member Avatar for Voltron160

Hello guys, I started this project but cant seem to finish it. You guys are my last hope, any help would be GREATLY APPRECIATED.These are the requirements, it seems I am mixed up. The owners of Body Language Fitness Centre require an information system that can manage and maintain their …

Member Avatar for jephthah
0
128
Member Avatar for Muhammadlodhi

This is begining. BALANCE PARANTHESIS and show the result of ((9-4)/(44*34)) etc ??? what to do? int main() { char arr[30]; for(int i=0;i<30;i++){ if(c=='(') c++; else if(d==')') d++;} if(c==d) printf("parenthesis are balance"); else printf("are not balance"); } further cant understand.

Member Avatar for Adak
0
151
Member Avatar for Gonbe

Hello Daniweb. [B]Scenario[/B] For a project we have to write a irc server. For this, we first wanted to investigate what kind of server architecture we should apply. (e.g. multithreading, multiplexing, multiprocessing etc.) We've written simple servers which implement different architectures. The servers basicially receive a message, and then send …

Member Avatar for nezachem
0
140
Member Avatar for DCvonB

Hello, I am trying to get the following code to print out the number of days in each month using pointers. This what the program currently prints: Enter a year (ex. 1997): 2001 Year entered: 2001 --Not a Leap Year!-- Number of days in each month: January: 0 February: 0 …

Member Avatar for Aia
0
152
Member Avatar for Xufyan

how can i add the last value to the current value using loop..? i tried so much but didn't find the answer :( [CODE]void main(void) { int numbers,add,sec; clrscr (); for (numbers=1;numbers<=49;numbers++) { for (sec=numbers;sec<=numbers;sec=numbers+sec) printf ("%d ",sec); } getch(); }[/CODE] here the loop is from 1 to 50, i …

Member Avatar for Xufyan
0
102
Member Avatar for Cheran

hi everyone... i"ve to pass a string as a returning value.but wat is the problem is there is an integer in the middle of it.the problem arise here.. [code]char* my_string( char* dest,char *c) { char str1[25] = "C:\\windows\\"; char str2[25]; char str3[25] = ".jpg "; strcat(dest,str1); //append str2 to str …

Member Avatar for Aia
0
142
Member Avatar for pramoda.ma

Hi All, How to copy one 2D-array to another without using loops and library function of C. Not pointers. Regards, Pramod

Member Avatar for Ancient Dragon
0
5K
Member Avatar for mariosbikos

hi guys i have an urgent problem....we have been asked to make a battleship game in C which will have the formation of ships taken by a file txt.....for example 00000000 ppp00000 0000nnnn 00000000 etc...i want to open the file txt and then put every single character 0,p,n etc to …

Member Avatar for mariosbikos
0
293
Member Avatar for deeep

Hello Guys, I have implemented a linked list. And my output looks something like dis: ************************************************* The elements in the list : address is = 163196952 ADOC1100250100000119666 address is = 163196968 ADOC1100250100000119666 address is = 163196984 ADOC1100250100000119666 address is = 0 ADOC1100250100000119666 TOTAL NO OF ELEMENTS IN THE LIST ARE …

Member Avatar for jephthah
0
170
Member Avatar for shahab.burki

Hi, I am stuck in file reading problem. I have tried various solutions but nothing worked. Actually I can't develop a logic to do so. I want to read some lines from file and pass them to structure. When reading a file you must use WHILE loop. I am posting …

Member Avatar for jephthah
0
98
Member Avatar for buckkitty

Does anyone understand why Data2 would not equal Data? I print, and can see, that they LOOK the same, i.e. have the same number of rows and columns with the same values in each element. But when I pass the matrices to a calc function, they give different results. I …

Member Avatar for buckkitty
0
89
Member Avatar for ericas5

New to C and haven't had any problems until now - I can seem to get straight with passing arrays between functions. Here is what I need to do: Write a program that declares 3 single-dimension arrays named bookPrice, numBooks and totAmt. Each array should be declared in main() and …

Member Avatar for ericas5
0
149
Member Avatar for denis_stoyanov

Well i'm just starting to study recursion and i have a small problem. I'm trying to write a program which generate every six digit combination where every digit is used only one time. I've writed an iterative (i think this is the correct term) : [CODE]#include "stdafx.h" using namespace std; …

Member Avatar for Banfa
0
84
Member Avatar for Muhammadlodhi

[I][B][B][/B][/B][/I] i want to put the answer like user enter any odd number then out put will be like this one if 3 *** * * *** the even rows shows only 1st and last stars LIKE 5 ***** * * ***** * * ***** [CODE] int main(){ int num,i,j,k,l; …

Member Avatar for Muhammadlodhi
0
259
Member Avatar for Iam3R

what is the correct declaration of pointer to a pointer to array of N elements. ( i want to store address of pointer to an array of n elements ) i am using the below declarions seperately , but getting errors. [CODE] int (*p)[4]; int (*p1) (*)[4] = &p; int …

Member Avatar for UncleLeroy
0
143
Member Avatar for kedarm

Hi! I'm trying to use the nanosleep and sleep functions in a program I am trying to write. I first tried this - [CODE] fprintf(stdout,"Hey guys.."); struct timespec t_req, t_rem; t_req.tv_sec = 1; t_req.tv_nsec = 500; if (nanosleep(&t_req, &t_rem) < 0) return 0; fprintf(stdout,"...What's up?");[/CODE] Since the function nanosleep did …

Member Avatar for mitrmkar
0
955
Member Avatar for shahab.burki

Hi, When I assign the value of one structure variable to the other I got the error "incompatible types in assignment". The Code is the following. The Problem line is 91. [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> struct file_data{ char src_ip[18]; char dst_ip[18]; char src_port[8]; char dst_port[8]; char p2p_proto[18]; struct …

Member Avatar for WaltP
0
156
Member Avatar for alcx88

I am having troubles getting my program to work. It is supposed to take integers from a file and put them into an array. Then it is supposed to sort them by the bubble sort algorithm. [CODE]#include <stdio.h> #include <ctype.h> #include <stdlib.h> #define N 10000 int main(int argc, char *argv[]) …

Member Avatar for Adak
0
130
Member Avatar for LMat619

Hello everyone! I am new to this forum (and C programming) but I hope that I will be able to master C help anyone out with problems in the coming months. But I am having trouble with my own program for an assignment. I am asked to simulate a user …

Member Avatar for WaltP
0
232
Member Avatar for Muhammadlodhi

HI i made this program for odd inputs if press 5 then ***** * * ***** * * ***** but not showing the correct answer. write a right code if u can plz thanks alott. [CODE] #include <stdio.h> int main() { int num, i; printf("press any odd num"); scanf("%d", &num); …

Member Avatar for jephthah
-2
291
Member Avatar for Muhammadlodhi

I need your help AT ONCE plz IN C CODE ONLY i have a program to make an array of length 30 and NOW write equation like this ((3+4)-(24/5)) .... the paranthesis must be balance and the output of the operation must be shown IF paranthesis are balanced. HELP ME …

Member Avatar for Nick Evan
-5
136
Member Avatar for Muhammadlodhi

Hey guys and girl i need your help in program only in C CODE user press only odd numbers then the following result has been shown like if 3 then *** * * *** if 5 then ***** * * ***** * * ***** PLZ HELP ME >>>> Thanks

Member Avatar for Salem
-2
364
Member Avatar for geekgirl2011

I am so lost in this programming assignment. Here is what I am suppose to do: A. Define a struct that represents a CAT as follows: A CAT has a weight, name, and a neutered flag, i.e., those are the components of the struct. Use a typedef. B. Declare a …

Member Avatar for jephthah
0
201
Member Avatar for riahc3

Hey I rather not use conio.h for cross compatibility so is there any way to make my own "conio.h" and just include it in my compilation. Thanks.

Member Avatar for jephthah
0
1K
Member Avatar for sangramanand

hi all, i created a window using c, next i want to add a text box in the window. Since am working on 32-bit, i donno which functions to use in that.... pls suggest me the procedure to implement this......

Member Avatar for jephthah
0
48
Member Avatar for reshmasalian

heya, watz de meanin of malloc.h n alloc.h in c-programmin(both are different)? what is the difference between 1 pointer n 2 pointer in link list of stack? wat is the meanin of arrow mark pointer?

Member Avatar for sanji17
-4
195
Member Avatar for urbangeek

the code is: [CODE] slen=strlen(str); for(count=0;count<=slen;count++) { flag=0; if((int)str[count]!=32) { for(count2=count+1;count2<=slen;count2++) { if(str[count]==str[count2]) { flag=1; break; } } if(flag==0) { ar[ar_count]=str[count]; ar_count++; } } }[/CODE] at line 5 the != operator working fine but when i put [ICODE]if(((int)str[count]>=65 && (int)str[count]<=90) || ((int)str[count]>=97 && (int)str[count]<=122))[/ICODE] it's not working.. if you've some …

Member Avatar for WaltP
0
167
Member Avatar for hosam2k

hi all im stuck to my assignment 1. i want to know how to use function search in order i can search each character in a string then count the number of it. for example: given : home alone the output will be : the string has 9 characters including …

Member Avatar for Adak
0
144
Member Avatar for shahab.burki

Hi, I am working on structures. One of the structure member is char array i.e string. When I assign another string to this then it throws the incompatible error. The code is the follwing. The problem line is commented. Code: [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> struct file_data{ char src_ip[18]; …

Member Avatar for shahab.burki
0
175
Member Avatar for Xeros606

The End.