15,551 Topics
![]() | |
[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 … | |
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 … | |
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 … | |
![]() | 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 … ![]() |
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 | |
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 … | |
![]() | 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 … |
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> | |
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 … | |
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 … | |
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 … | |
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 … | |
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; … | |
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 | |
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) :) | |
//*************************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 … | |
[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] | |
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 … | |
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 … | |
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. | |
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 … | |
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. | |
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 … | |
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 … | |
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 … | |
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 … | |
Hi All, How to copy one 2D-array to another without using loops and library function of C. Not pointers. Regards, Pramod | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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; … | |
[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; … | |
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 … | |
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 … | |
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 … | |
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[]) … | |
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 … | |
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); … | |
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 … | |
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 | |
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 … | |
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. | |
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...... | |
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? | |
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 … | |
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 … | |
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]; … | |
The End.