1,088 Posted Topics
Re: [quote=locy;452801] where did i make mistake[/quote] The success of your program hinges upon your ability of understandig first how to get the total addition of each digit of an integer. I hope this will clarify for you how to do so. [code=C] /****************************************************************************** 01234 is made out of 1000 + … | |
Re: [quote=jasimp;446448]Can conservatives do anything accept bash liberals?[/quote] Yeah, we work for a living, without coveting anyone else's money in any form of social program. | |
You have a problem with your code. You need help. You are in a hurry. What can you do? Post for help at Daniweb as fast as you write, correct?. Wrong. The first thing you should do is to read the rules on posting and specially how to properly make … | |
Re: Your program doesn't compile because you have a char variable name: [B]char words;[/B] and another integer variable array with the same name: [B]int words[WORDS_SIZE] ; [/B]Why do you insists in using[B] gets (string); [/B]here and here int words[WORDS_SIZE] = {[B]gets (string)[/B]}; when Narue already told you: "Don't ever use gets. … | |
Re: [code]int freq[11]={0}; //why make freq[11] for 11 variables?//[/code] Valid user input is from 0 to 99. You divide that range in units of 10 and you get ten groups. The extra variable is to hold an extra group for any possible input from the user beyond that range. In other … | |
Re: [code=c] char *cmd[100]; /* this is an array of pointers */ char argument[100]; /* this is just ONE array of 100 elements long */ cmd[i]=argument; /* Each time a new pointer element is pointing to the same array string */ [/code] You are changing the string every time through the … | |
Re: [quote=locy;450248]how do i write a C programm with the output ++++++ or *******[/quote] Give it as an argument to the printf() function, or learn how to use a [URL="http://www.geocities.com/learnprogramming123/Clesson9.htm"]loop[/URL]. | |
Re: Pedro, welcome to the forum. If I understand you correctly what you need is to parse the lines into individual tokens. Take a look at this [tutorial](http://www.daniweb.com/code/snippet444.html). Next time make sure you encase your code in CODE tags. That will ensure proper format of the code and easiness of read. | |
Re: [quote=locy;450278]i try to intsall cygwin but i got a problem,is there any easy one that i can understand.i m a beginner in programming[/quote] [B]FWIW[/B]: Some [URL="http://www.geocities.com/learnprogramming123/Cdownload.htm"]compilers[/URL]. | |
Re: [quote=mooseguy;447967]Yes, but how would you get the letters?[/quote] [code=C] for ( i = 0; i < 25; i++ ) { printf( "%c: %d", 'A' + i, letters[i] ); if ( ( i + 1 ) % 4 == 0 ) { putchar( '\n' ); } else { putchar( '\t' ); … | |
Re: [B][B]>Helppppppppppppppppppppp i will kill my self soon[/B][/B] It will a waste of time to help you if you are going to kill yourself soon. What's the point of helping? Now, if you change your mind about the minor problem, you could always make a stop to read the rules about … | |
Re: [quote=Exsiss;448030] Can you give me a few lines of example for it? I just need a point in the right direction.[/quote] A few lines is all that is needed, and I am afraid that would rob from you the experience of learning. Look at this and give it another try. … | |
Re: [quote=use4d;446158] (e) DO THIS ONCE A DAY ONLY UNTIL NEW HAIR GROWTH APPEARS[/quote] And if that fails at least you'll always have a shinning head. ;) | |
Re: [code] struct inFile { char itemNumber[32]; int timeToFinish; int elapsedMinutes; }; typedef struct inFile inFile;[/code] You create a structure data type and even typedef but you do not define any variable of type structure for your main to use. [code] fscanf(fn, "%s, %d, %d,", inFile.itemNumber[i], inFile.timeToFinish[i], inFile.elapsedMinutes[i]);[/code] You are forgetting … | |
Re: Yeah, I am for it. It should show as `invisible [B]aka[/B] Dave Sinkula'. ;) | |
Re: [quote=furpacino;443526]oke i am sorry for before i didnt know about this side so much. Now i am sending a file with attachemnt. I have to rewrite this while loop. if you help me i will presuade about your helps.[/quote] [B] *Whew*[/B] We were so concern that you would take such … | |
Re: [quote=theraven1982;443388] [code=c] void initialpos(struct atom *name, int N) { int i; for (i = 0; i < N; i++) { name[i].x=drand48()*20; name[i].y=drand48()*20; name[i].z=drand48()*20; printf("pos of %d: %f\t %f\t %f\t \n", i, name[i].x, name[i].y, name[i].z); } } [/code] [/quote] Taking this as an example: [COLOR=Red] name[i].x=drand48()*20;[/COLOR] You are assigning to a … | |
Re: [quote=abhishekgahoi;442491]#include <stdio.h> int main() { int i=5; printf("%d %d %d %d %d", --i,i--,++i,--i,i); return 0; }[/quote] [URL="http://c-faq.com/expr/evalorder2.html"] Undefined Behaviour[/URL]. | |
Re: [quote=sakthi_2001;442740][...] to find sum of digits of a 5-digit number without using control statements, like if, for... thank you[/quote] [quote=twomers;442769] make an array, loop through, and sum: [/quote] Read the question again? | |
Re: [quote=aldrinsms;440865]How to make a program yhat make the transpose of a matrix using C ofcourse.[/quote] Did you read anything in this thread that indicated or makes reference to your particular question? Please, post your question in a new thread of its own. However, before doing that, use the search bottom … | |
![]() | Re: [quote=fatihpiristine;441854]Hello guys, I want to improve up my skills programming in C and Phyton on Linux. I have no idea which version of Linux is good to do this. So far I have tried Fedora 7, Slackware and StartCom Enterprise. I couldnt find what I really want. Few years ago … |
Re: [quote=Narue;441248]>Since 'A' is the internal value 65, 'B' is 66, 'C' is 67, and so on, >subtracting 'A' from your letter will give you 0, 1, 2, and so on. This is a non-portable assumption.[/quote] Are you refering to [B]Extended Binary Coded Decimal Interchange Code[/B] ([B]EBCDIC[/B])? | |
Re: If I may I would like to make an observation. In order to return a string from a function to main, is necesary an understanding of pointer variables and variable scope. This code will never work: [code=C]#include <stdio.h> char *mystring() { char s[] = "I don't see the point"; char … | |
Re: [quote=khalid0404;436865]the new algorithm will consist of combining Huffman and Shannon-Fano coding system, which will be later translated in C language. Any proposals???[/quote] Go ahead!. Post it afterward. | |
Re: Some error I found. By any means not the only ones. I did not pay attention to the logic of your program. I am sure that there's need to considere that part too, [I][B]id est[/B][/I] free any of the dynamic memory that you call after been used. [code=C] #include "stdio.h" … | |
Re: I am kind of confuse now. I always thought a literal string was [B]static [/B]and [B]constant[/B]. Which made me believe that it would be part of the [B]static memory[/B], like a [B]global static variable[/B]. And that it would be undefined behaviour if you tried to change it by using a … | |
Re: [quote=BigFormat;430079]Hi guys, I've got troubles with a conversion. [/quote] [code=c] int *numbers[nums]; /* this is an array of pointers of type int */ char *p; /* this is a pointer to a string */ numbers[i] = p; /* You are trying to assign a string to an element of the … | |
Re: [code=C]scanf("%s",&make); scanf("%s",&model); scanf("%s", &color); scanf("%s",&plate); scanf("%s ",&sfname);[/code] These will have an effect that you did not intended. The format %s is for strings or arrays of type char, and when you pass it to scanf you don't need the & operator. Futhermore you have declared those variables as a single … | |
What would be the command in the XP cmd.exe to connect and access a smb shared directory from another XP box? Thank you. | |
Re: [url]http://www.daniweb.com/forums/thread50370.html[/url] | |
Re: [code=c]Given the matrix array: char matrix[][4] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' }; Transpose means the rows becoming colums and the colums becoming rows. Calling the first element of the first dimesion subscrit will produce the first transpose row: matrix[0][0] 'a' matrix[1][0] … | |
Re: [quote=Hamrick;429060]If printf didn't return a value, it would return void. There aren't any values of void type, so something like this shouldn't ever compile. That means it's not valid. [/quote] printf() always returns an int. Not a void type. If an error happens it will return a negative integer for … | |
Re: ^ He's the SpoilSport one. And he really looks like his avatar. What's not to like? | |
Re: > I understand what pointers are, but I don't understand why they are useful. >Good god that is long, but it looks useful thanks! Many pages have been written in articles, tutorials and book chapters about [B][I]pointers[/I][/B] in C programming. A typical approach would be to explain how a variable … | |
Re: [quote=amishosh;421529] When compiling with Borland C it worked fine. However when I tried cimpiling it with VS 2005 I got the following error: "Unhandled exception at 0x00413529 in Learning C.exe: 0xC0000005: Access violation writing location 0x00415645." But based on what I learnt in C I don't understand why it did … | |
Re: I must confess I am a little confused concerning this part of your question; >And my last problem that I'm having is with letting the user type in their full name while using only one variable instead of three like I have it. and also these portions of your posted … | |
Re: To read integer and floating-point values you need to learn how to use two functions: fgets() to read it and sscanf() to obtaing the value from the string read by fgets(). Here's two snippets of how this might be achieved. [URL="http://www.daniweb.com/code/snippet266.html"]Read an Integer from the User[/URL] [URL="http://www.daniweb.com/code/snippet357.html"]Read a Floating-Point Value … | |
Re: >it is still 0x7803a710. I was expecting it to be freed to 0x00000000. Your expectation is not realistic. Freeing some memory do not mean that is zero out. It means that is available for other uses. A perfect example would be if you declare an int variable and do not … | |
Re: [quote=NycNessyness;414840]I'm still trying to figure out how to get the calculations to work in my program. If someone can shed some light on that area for me, it would be greatly appreciated. Thanks again.[/quote] Without trying to discourage you, I have to say your code is full of errors. My … | |
Re: There's quite a few things wrong in you function. Compare with this. File is not the same that FILE. File *fp is not a string. ptr == fopen is not the same that ptr = fopen. [code=C]void write_string( char *fp, char *s) { FILE *ptr; int i; ptr = fopen( … | |
Re: [quote=grii_19;416220]i thought the functions part would be simple but giving me a lot of headache now i tried passing 2 values int and float but again same error ? can ne1 tell why ? referring let us c using tc . assume in square function above what are the lines … | |
Re: [quote=joshSCH;399504] Perhaps she is logical; however, one must be quick witted in the game of chess.. Smarts, logic, luck.. all play a good part. [/quote] Luck doesn't have anything to do with it. If you need luck to win, then you need to keep practicing. ( Talking in generic terms … | |
Re: [quote=kgbalaji1980;415291]Hi, I need help for this C Program very urgent. please find the attachment below[/quote] Post what the program is suppose to do, and what is not doing correctly. Post any error messages you are getting at compile time, in essence tell us what's the problem that you are having … | |
Re: [quote=TkTkorrovi;415534]Well the easiest, if you have only one input file, is [code] gcc something.c -o something.exe [/code] But better is [code] gcc -std=c89 -Wall something.c -o something.exe [/code] This is for windows, in linux the executables usually have no extension, they can have, but exe in linux is kind of … | |
Re: What's your question?. Post what is this program suppose to do. What kind of malfuntions it has, what copiling errors you recieve, etc, etc,... | |
Re: I believe that more people are going to help you if you post your code , instead of send it as an attachment. Your code is not as long as to need to be an attached file. You need to work in the formatting of the source file. As it … | |
Re: [B]As a way of explanation: [/B]When you pass an argument to a function, that variable is always a copy of the one passed. Except pointers and strings made out of char arrays which are pass as a reference and not a value. Said that, let's take this function as a … | |
Re: >What does it need? It needs to be sanded down all the way from 120 to 150 grit sand-paper. After that it needs a 3 coats of polyurethane, waiting at least a couple hours in between coats. Make sure you sand with 480 grit the finish between coats. Oh!, You … | |
Re: It's a good thing she is 18 years old. Which it would mean I don't have anything to say any more. She was old enough to get pregnant, she's old enough to start taking decisions in her life. I would be happy to give any sugestion if she asks me. … | |
Re: [quote=DeathEvil;414540]with sprintf i got some more luck, but when I print it later on, there is some junk that is printed after it [/quote] If printf is displaying garbage is because you are missing the '\0' ( null terminator ) at the end of the string. You need to add … |
The End.