15,551 Topics

Member Avatar for
Member Avatar for alex1050

I need help understanding the do-while loop in this code. Im confused in how this do- while works because what i understand is the statement is executed then the expression is evaluated if nonzero and executes whats in while(). But its a loop so for example if i type Jack …

Member Avatar for Aia
0
194
Member Avatar for krabz01
Member Avatar for asrockw7

So I've finished C in school. Finished a Deitel book about C(The C part at least) though unprescribed. I know there's more, but 'how to' books isn't going to cover it. The school library isn't helping. I want more indepth info/lessons about C and I don't know where to go/begin …

Member Avatar for asrockw7
0
396
Member Avatar for wani_raj

I want to write a program which simulate the behaviour of CSMA/CD protocol over Ethernet.

Member Avatar for ryu_hemt_always
0
2K
Member Avatar for manaila

Hi I have a large C program which executes continuously, that is [I]listening[/I] to the user inputs, it is in an event loop. Now I want to have two different functions in that code to be executed simultaneously, in parallel. I tried to use fork() but the problem is in …

Member Avatar for manaila
0
154
Member Avatar for sshejale
Member Avatar for Hesham Moustafa
Member Avatar for tubby123

Hey, is there a function/call in c in windows to find the place from where your C-Development Environment is running. For example, (in case of Turbo-c), MOSTLY it is C:\TC\bin. Can i find this from within the program and output to a string or something ???

Member Avatar for TrustyTony
0
87
Member Avatar for anithakc

Hi please find this simple program, not sure why realloc is not working and its causing memory leak. But if calloc and malloc is used with little changes it works fine. [CODE]#include "string.h" #include "stdio.h" #include "stdlib.h" char *mystrcat(char*, char*); void main(void){ char str1[] = "quick brown fox"; char str2[] …

Member Avatar for anithakc
0
352
Member Avatar for cesione

i want to write a program that will prompt the user for the type of conversion he wants: “binary to decimal” or “decimal to binary” -If he chooses “binary to decimal”, the program should prompt the user for 8 bits (values only 0 or 1) and then display the number …

Member Avatar for N1GHTS
0
2K
Member Avatar for tubby123

Guys before i post my problem , lemme say that, i HAVE gone through the previous blogs/forums on daniweb, so please dont get annoyed with this topic again. But none of them answer my question My question is, "How do you write a structure to a file and retrieve data …

Member Avatar for Narue
0
2K
Member Avatar for celestial_sea

Hello guys! i really need your help. In my program, I am reading the contents of the file. File looks like this: [CODE] 1 ART ACE APE 2 BAT BOY 3 CAT COP CUP CAP CUT [/CODE] I want to store the words in an array. one array per line. …

Member Avatar for Adak
0
143
Member Avatar for bettybarnes

hi just wanna ask how to transfer a file from a peer-to-peer wired connection a character input from a node to another node. this is my simple code: [CODE]#include <stdio.h> #include <stdlib.h> #include <conio.h> int main() { char x; printf("Enter a character: "); scanf("%c", &x); getche(); }[/CODE] when the 1st …

Member Avatar for BlackJavaBean
0
155
Member Avatar for subith86

Hi all, I'm trying to get an octal number from console and store it in an int variable using scanf. Here is my code. [CODE] int n; scanf("%i", &n); printf("\nEntered number in dec = %d", n); printf("\nEntered number in hex = %x", n); printf("\nEntered number in oct = %o", n); …

Member Avatar for subith86
0
114
Member Avatar for tubby123

Hey, this one is agaain from File-handling How do you replace a word in a file with another word. The algorithm should be somewhat like this 1)Read (fgets) the entire line into a buffer. Locate the word/ position of the word. 2)From that point onwards, OVERWRITE the contents in the …

Member Avatar for Adak
0
177
Member Avatar for cesione

I just started leaning c programming, and i have been doing alright, but now am stuck with a problem, I do not know how to read information from a file in c. the file contains info like; 123456789123456789123456789123456789...and so on. i have to read the file in, and then group …

Member Avatar for Ancient Dragon
0
170
Member Avatar for simply_viks

hello, i am having an array having 16 values char index[16]={1,2,3,4,5,6,7,8,9,10,12,13,14,15,16}. my question is i want to store the first,4th,8th and 12th value in arrar A (ie A[0]=1,A[2]=5,A[3]=9,A[4]=13). the 2nd,6th,10th and 14th in array B. the 3rd,7th,11th,15 in array C. the 4th 8th, 12th 16th in array D please help. …

Member Avatar for simply_viks
0
92
Member Avatar for gaurav_13191

Hi all, I have a minor confusion regarding the variable accessed Consider: [CODE] int a=5; //global variable void increment(int a) { ++a; } [/CODE] If I call increment() in main(), which a will be incremented (a passed as a parameter to the function or the global a ?) Also specify …

Member Avatar for gaurav_13191
0
76
Member Avatar for VernonDozier

I have a simple program. [code] // test.c #include <stdio.h> int main() { #ifdef HELLO printf("Hello "); #endif printf("World\n"); return 0; }[/code] I'd like to set up a makefile and either define HELLO or not in that Makefile and then either the program displays "World" or "Hello World" based on …

Member Avatar for VernonDozier
0
171
Member Avatar for dharma117

[CODE] //1>program for piramid. --------------------------- #include<stdio.h> #include<conio.h> void main() { int i,j,n,a,k=0,m; clrscr(); scanf("%d",&n); m=n*2; a=m/2; for(i=0;i<m;i++){ printf("\n"); if(i<a)k++; else k--; for(j=0;j<m;j++){ if(i>=a||j<a-(k-1)||j>a+(k-1)) printf(" "); else printf(" *"); } } getch(); } //2>program for Revrse piramid. --------------------------- #include<stdio.h> #include<conio.h> void main() { int i,j,n,a,k=0,m; clrscr(); scanf("%d",&n); m=n*2; a=m/2; for(i=0;i<m;i++){ printf("\n"); …

Member Avatar for Adak
0
245
Member Avatar for tubby123

This one comes from file-handling. Say , i have a file of 95,000 lines. I have to analyse only those lines which start with a semi-colon. So my logic would be like, "Read first character of the line, if it IS a semi-colon, process it, otherwise jump to the next …

Member Avatar for Adak
0
91
Member Avatar for nered

[CODE] #include <stdio.h> int main(){ char *names[1024]; float *rates[20]; FILE* file; file = fopen("tecaji.txt","r"); while(!feof(file)){ fscanf(file, "%s", &names); for(int i = 0; i < 20; i++){ fscanf(file, "%f", &rates); } } for(int a = 0; a < 50; a++){ printf("%s", names[a]); } } [/CODE] The file contents look like this: …

Member Avatar for Aia
0
132
Member Avatar for Manske

This program separates palindromes from non-palindromes in a text file. After separating them into separate two dimensional arrays, I have to sort them in ascending order by string length. The last part is to output both the palindromes and non-palindromes in centered, triangle format. I've gone through this program multiple …

Member Avatar for Manske
0
151
Member Avatar for dgreene1210

-The program should print "COP 2220-50184 Project 3: <your name>" with a blank line before and after. -Then it should prompt the user for the input file name of the file containing the data to sort. - If the program can't open the file or if no file name is …

Member Avatar for TrustyTony
0
265
Member Avatar for Lost in Code...

Greetings, I'm having a problem with this code below. I want to ask 3 questions and then gather userinput into char variables. When I run the program it asks the first question and then outputs the answer. Then it asks the second question, but does not allow the user to …

Member Avatar for bajishareef
0
5K
Member Avatar for arshi9464

i want to know, what kind of addresses do pointers deal with? i mn logical or physical? and how can i access a particular memory area using pointers? PLEASE HELP.......

Member Avatar for TrustyTony
0
146
Member Avatar for sharathg.satya

can any one help me in solving a question posted by friend..... i tried to google but i didnt find the accurate answer for my question.. i wish to 'print 1 to n' without using loops and recursion help me please.. thanks in advance

Member Avatar for bajishareef
0
269
Member Avatar for jdarrel006

im totally noob using Turbo C.. i know this is just a basic prog, but of course i cant do it because i've started using Turbo C.. Name: Age: Gender: something like that.. or like doing a resume in Turbo C.. thanks in advance..

Member Avatar for Adak
0
78
Member Avatar for cheenu02

hi, the following program is not running and gives CANNOT CONVERT INT TO INT* IN MAIN FUNCTION error [CODE]#include<stdio.h> void main() { int *p; p=0x2000; ++p; printf("%d",p); }[/CODE] how to solve this

Member Avatar for bajishareef
0
2K
Member Avatar for richa_talwar08

Hi All, I need to write a code in C or C++ where some text in text_file_1 needs to be replaced with some other text which is in text_file_2. both the text files are stored at some location Text_file_1 has text: user,pass jojo, beans where jojo and beans need to …

Member Avatar for Adak
0
443

The End.