15,552 Topics
| |
hey, this is supposed to collect data into a 2 by 3 array. believe it or not, my teacher wrote this problem and he spent 20 minutes trying to figure out why it wasn't running properly. anyone care to help me figure out what was wrong with it?? [CODE]#include <stdio.h> … | |
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 … | |
how do run a cprogram on shutdown or restart | |
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 … | |
I want to write a program which simulate the behaviour of CSMA/CD protocol over Ethernet. | |
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 … | |
where can i participate in C projects ?? | |
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 ??? | |
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[] … | |
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 … | |
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 … | |
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. … | |
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 … | |
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); … | |
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 … | |
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 … | |
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. … | |
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 … | |
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 … | |
[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"); … | |
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 … | |
[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: … | |
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 … | |
-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 … | |
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 … | |
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....... | |
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 | |
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.. | |
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 |
The End.