15,551 Topics
| |
When I execute this code ,it accepts 2 nos,prints the msg enter your choice and terminates.. [code=c] #include<stdio.h> int main() { char ch; int a,b; printf("enter 2 nos :"); scanf("%d %d",&a,&b); printf("\nenter your choice:"); ch=getchar(); printf("%c",ch); switch(ch) { case '1': printf("sum : %f",a+b); break; case '2': printf("diff : %f",a-b); break; … | |
Its pretty rare for me to post questions here but I came across this one about qsort I can't answer. If I try to sort an array of character strings such as [icode]char array[255][20][/icode] qsort works ok as expected. But if I declare the array like this qsort fails: [icode]char*array[255][/icode] … | |
[I]<< split from the "[URL="http://www.daniweb.com/forums/thread66649.html"]removing the null terminator at the end of string[/URL]" thread >>[/I] But, Lets say what you have stored in your buffer is the contents of your file that you've open,. How do you get all the content of that file into your string without it stopping … | |
Hi, I want to write a program to split one file into multiple files. At any line that contains: "# Name:" i start writing to a new file. My problem is that i want to save each file with a name i extract from the same line. Example: # Name: … | |
The following code consists of 2 functions: one called Options and the other called checkOptions. The Options function is fine. No problem, it is taken from Johnson M. Hart's book. The second function was added on to attempt to complete an exercise at the end of the chapter. Okay, the … | |
hello i am george.i have to do 2 exercises in c/c++ and i dont know a lot of programming.the exercises are: 1) code for depth first search with adjacency list for every graph 2)code for Dijkstra algorithm with weight graph if somebody knows something(code,links,etc...) that could help me please contact … | |
I want to pass a float array from one function to another function I want to make use of the float array type(here container) [code=c] void funct1() { float container[4]={0.1,0.2,0.3,0.4} void funct2() ----(1) {return container;} } void funct3() { void funct2(); use container array; }void funct1() { float container[4]={0.1,0.2,0.3,0.4} void … | |
[code=c] void main() { TRISA=0x00; TRISB=0x00; while(1) { PORTB=0x06; PORTA=0x01; delay(10); PORTB=0x5B; PORTA=0x02; delay(10); PORTB=0x4F; PORTA=0x04; delay(10); PORTB=0x66; PORTA=0x08; } } [/code] This a few program that i make in creating a scoreboard for basketball using PIC 16f84a..Is this program correct?? | |
I have a C program I am writing and need this program to write to syslog and have the logs in a separate file for my program. Eg. My program is called "example.c", then I want to have a log file called "example.log" in /var/log. Do I define log file … | |
[QUOTE]The function time() retrieves the current calendar time from the system's clock. It has the following prototype: time_t time(time_t * tp); In systems in which no clock is available, the function returns -1.[/QUOTE] Part 1: I found this on the internet. I have a question about the above quote where … | |
hi, i have the following program [CODE]see the attachment[/CODE] when i try to compile through the command line {with the scipt compile} everything works fine... when i try to use my makefile...i get tons of errors.... It is my first serious try with makefiles and i would like some assistance … | |
Hi, I am trying to find the header file monetary.h and the function strfmon() to do some currency conversions, but Visual Studio 2005 compiler doesn't seem to support those. Does anyone know if there is an alternative function I can use ? Thanks a lot. | |
im trying to sort my random numbers to odd numbers and even numbers,, the last part of my code is really wrong.....(the sorting part) [code] my code: #include<time.h> int main() { int num[50]; int x,odd,even; srand(time(NULL)); for(x=0; x<50; x++) { num[x] = (rand()%60)+40; } for(x = 49; x>-1; x--) { … | |
Can someone tell me what value would each of the line of code will have, when you go through this code: Here is the full code: server.conf: [CODE]interface=192.168.0.2; log=/var/log/example; [/CODE] example.c: [CODE=c] conf_fd=open("/etc/example/server.conf",O_RDONLY); read(conf_fd,conf,100); close(conf_fd); /* Get server IP */ buffer=strtok(conf,";"); buffer1=strtok(NULL,";"); strtok(buffer,"="); server=strtok(NULL,"="); server_ip=inet_addr(server);[/CODE] What is the value at … | |
Hi, I need some information regarding the APIs to use, to get the drive letter, if I know the label of that drive. For eg, my hard disk has been partitioned into 3 drives, C:, D:, E:. The labels (label1, label2, label3 )for these drives have been assigned dynamically. I … | |
i have an array which contains third level pointers : [CODE]char * arrP1 [ ] = { "father", "mother", NULL}, * arrP2 [ ] = { "sister", "brother", "grandfather", NULL }, * arrP3 [ ] = { "grandmother", NULL}, * arrP4 [ ] = { "uncle", "aunt", NULL }; char … | |
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would try my own small program. The problem is, I seem to be having trouble with memory, … | |
hello i have this code int main () { char * arrP1 [ ] = { "father", "mother", NULL}, * arrP2 [ ] = { "sister", "brother", "grandfather", NULL }, * arrP3 [ ] = { "grandmother", NULL}, * arrP4 [ ] = { "uncle", "aunt", NULL }; char ** … | |
HEY FRIENDS THIS IS MY EFFROT I'VE MADE A PROGRAM THAT'LL ADD OR SUBTRACT 2 AND THREE DIMENSIONAL MATRICES !! PLEASE SEND YOUR REVIEWS ABOUT THIS PROGRAM AND SUGGESTION ON WHAT IMPORVEMENTS CAN BE MADE IN IT !! AND ALSO I NEED TO KNOW CAN THIS PROGRAM BE MADE BY … | |
i need to use large integers of the size 1024 to 2048 in a cryptography project using C... are there any header files available which will make my work easier if not ... how do i hanlde these integers using structures ??? By handling i mean multiplication , exponentation , … | |
im a 1st year comsci student and we are given an assignment that will display in words the number that is entered using logical operators and what we've learned so far(printf, scanf,etc.) I only have problems in displaying the numbers from 11-19 (when I input 12 is displays two twelve), … | |
I did a quick search on the forums and there was another problem similar to the one i'm trying to solve. I'm supposed to use the first word of a sentence as a search parameter and check the rest of the string for occurences of the word. If the word … | |
Added binary Tree just to help others..... [code=c] #include<stdio.h> #include<conio.h> #include<stdlib.h> void formatting(void); int input(void); struct binTree* createNode(struct binTree*,int); void insert(struct binTree*, int); struct binTree* searchNode(struct binTree*, int); struct binTree* search(struct binTree*, int); void dispTree(struct binTree*); struct binTree{ int item; struct binTree *leftChild, *rightChild; }*root=NULL, *node; void main(void) { char … | |
guys would help...with my assign...this is the problem... create a program to input 8 words with maximum of 15 characters.display the words in alphabetical order...tnx.. | |
I have read in a file, and i can print it out successfully, but i must sort the pointer to the array of structures. below is my code. I must sort the phone book in ascending order by zip code. If anyone could please help that would be great. [code] … | |
I am workring on a program that can simulate an array of disks and from an event list, record their mean time to failure (mttf), mean time to repair(mttr) and stop the program when it encounters dataloss. so we would also need to record the mean time to data loss … | |
i want to ask if any one could help me with this Q how to approximat a square root???????? PLZ help me i want example | |
here's the program i'm trying to run, but everytime i press ctrl+f9.. i get the error in that picture below.. [code]#include<stdio.h> #include<graphics.h> #include<dos.h> #include<conio.h> #include<stdlib.h> main() { int choice; clrscr(); printf("Please choose a version you like: "); printf("\n<1> Random lang\n"); printf("<2> Moribund...\n"); scanf("%d", &choice); switch (choice){ case 1:{ ran(); break; … | |
Hi , i''m Smith. I want to know more abou C pointers . And its use in C. Friends, those who are interested in this topic please give me good idea . First of all i want to know About basic things about pointers. What is a C pointer? And … | |
Hey everybody, Once again, I find myself humbled and confused. You see, I have a text adventure engine (although at this point its just a map traversal... doesn't end yet :P) and I'm having a few issues with the commands. I can move around the map just fine and I … |
The End.