136 Posted Topics
Re: [QUOTE=nateuni;998642]ok my bad I found out there was trailing crap from a previous scanf that was bunging things up.. and that flush is useless.... but I may have more questions.. so I want mark te thread as solved yet.[/QUOTE] You're making this more difficult than it needs to be and … | |
Re: @konohastar. We'll let you off this time ;) since that was your first post, but in future please use code tags when posting code. You'll find members of this forum more willing to help you out if you do this. Read the material at this link to learn how to … | |
Re: How about showing us what you have done so far? That would at least give people on this forum a good starting point as to how your problem could be resolved. It would also give us some indication as to your level of knowledge in C in general. | |
Re: First up, as a newbie, you need to learn how to post code correctly on these forums using code tags. You'll find that people will be more willing to help you out if you're prepared to show some effort in this area. Please read the information at the following link … | |
Re: [QUOTE=nateuni;994616]I am getting this error message, but I am not sure what I am doing wrong? Here is a edited snip-it of my code - [code=c] void WriteProgram(clientProgram *ptrToProgram, int *ptrTotalWkOuts, int *ptrNumOfEx) { int wkOut = 0; clientWorkout *ptrToWorkout; int *autoPopulate = (int *) calloc(1, sizeof(int)); clientWorkout *ptrToFirstWorkOut = … | |
Re: Are you friggin' kidding us? You need to read this: [URL="http://www.daniweb.com/forums/thread78060.html"]http://www.daniweb.com/forums/thread78060.html[/URL] and then you need to read this (how to post code): [url]http://www.daniweb.com/forums/thread93280.html[/url] Good luck! | |
Re: [QUOTE=gattewar;995464][ ..i want to build an student database using linked list and in c language...but i am unable to create nodes for each variable like age,name,roll no,and also i have to implement in that the suboptions like modify ,search ,sort, create n display plz tell me how can i implement … | |
Re: [QUOTE=adatapost;995202]@nateuni: I have been reading about memset but my understanding is it will not work for a struct. I think [b]memset[/b] is the way to go. You do not have many alternatives.[/QUOTE] Yes. I agree. Here's a sample of code I posted about a month ago to another member asking … | |
Re: I would suggest MinGW. A port of the GNU gcc compiler for Windows. Actually you get more than a C compiler, you get C++, Java and Fortran as well. If you're talking IDEs, then I would suggest Codeblocks or Eclipse - both use the MinGW toolchain. | |
Re: Add -Wall option when you compile. (ignore!!_ Sorry another brain fart. You need to pass the address of the parameters to your swap function like so: [CODE=C] swap (&i, &j); [/CODE] | |
Re: [QUOTE=geoffy0404;994375][CODE]int main() { int assignment1[30]; " "; int assignment2[30]; " "; int assignment3[30]; " "; int assignment4[30]; " "; int assignment5[30]; " "; int assignment6[30]; " "; int totalPoints[] = "assignment1+assignment2+assignment3+assignment4+assignment5+assignment6"; printf(" Grade calculator ... By Geoffrey Prata \n\n"); printf(" Please enter your grades \(in points\) after \n each prompt … | |
Re: [QUOTE=D_switch;991903] now im stuck as to how to display it in decending order[/QUOTE] Well you've almost done it. Change the comparison in your strcmp() to be "greater than" (>) to sort the names in descending order. In addition to studying up on why gets() is a poor function (use fgets() … | |
Re: This would have to be close to one of the most stupid assignments I've ever heard of. It just supports my claims on the quality of CS education these days. | |
Re: Just having a quick look at your code, you're not declaring your variables of type SYM correctly - you need to prefix the declarations with "struct". If you don't want to do this, you'll need to use a typedef. | |
Re: You're sort of on the right track. How about trying it out for yourself and see what happens rather than constantly asking for examples. And then post back if you still have issues - your learning experience will be far better this way. Also, learn how to post code properly … | |
Re: Are you kidding me? Why are you posting this as a code snippet? You should have posted this in the C forum as a "normal" thread". And quite frankly unless you are willing to put some effort in and pinpoint the minimal code that demonstrates your problem, I'd guess you're … | |
Re: A supposedly different thread in disguise. For the OP - stop wasting everyone's time by creating a new thread when you haven't even bothered with the pending conclusion of your most recently related thread: [URL="http://www.daniweb.com/forums/thread222917.html"]http://www.daniweb.com/forums/thread222917.html[/URL] | |
Re: @dkalita, We do not freely give out code on these forums unless the poster shows some effort. Since you are a "newbie", you need to read this: [URL="http://www.daniweb.com/forums/announcement118-2.html"]http://www.daniweb.com/forums/announcement118-2.html[/URL] | |
Re: You're making this more difficult than it needs to be. Look at this code snippet: [CODE=C] while (d != 0) { r = d % b; d = d / b; result[len++] = basechars[r]; } for (i = len-1; i >= 0; --i) { printf("%c", result[i]); } [/CODE] | |
Re: [QUOTE=wheel;988438]Other than adding the "&" to the scanf statement . . . Why do you do the following loop? [CODE] while(x<=num) //Checks the numbers for their status { detect(num); x++; } [/CODE] If you want to check all numbers between 2 and num, then you must detect(x) rather than detect(num). … | |
Re: How many times do you need to be told to use code tags? It's the third time I have asked you to do this. The strtok() function has its pitfalls which have been well documented - do your own research on this. Since this is more than likely an assignment … | |
Re: [QUOTE=MrNoob;985829]or i have to declare normal structure of same type and make the ptr get its address ?[/QUOTE] You can do it that way, or allocate memory to your structure pointer as in: [CODE=C] em1 = malloc( sizeof(*em1) ); [/CODE] | |
Re: For the OP - if I'm understanding your issue correctly, you are still experiencing problems getting the strcmp() function to return the fact that two strings are equal. This is happening because the fgets() function stores the newline character into the buffer and then you are comparing this buffer to … | |
Re: [QUOTE=keerthiga;981253]sum() integer x,y,z read x,y z=x+y print"the sum of x and y is",z end sum()[/QUOTE] In the relatively short time I've been participating in this forum, this would have to be one of the most irrelevant answers to a thread I have seen. keerthiga, did you actually read the OP's … | |
Re: It can't be that urgent if you can't even take the time to post an actual question. Try again - and ask a question this time. | |
Re: Besides all the other "evils" in your code that others have pointed out already, the logic of your max() function in your last post is incorrect. It appears to be returning the minimum value out of the three values passed in to the function. You should consider yourself lucky that … | |
Re: When using the sizeof operator with a type name, it must be enclosed within parentheses. | |
Re: [QUOTE=chathu12;964235]Hello Every one, I need to write a program to copy a part of a String from a specified place. Eg: if the first String looks like "This is a C program" I need to extract the part of "C program" How can I do this.Please help me. Can I … | |
Re: [QUOTE=chathu12;964110]Hello every one?I have a program use to copy the contents of an array to a File.But it does not work. when it runs Visual Studio starts to debug. But nothing happening.File contents does not change.Please help me tho solve this problem.Thank you very much. Here is the program. [CODE]#include<stdio.h> … | |
Re: [QUOTE=siddhant3s;961806]>1. Passing into a function and then into a sub-function. Did you asked Google? Anyways, I did it for you: [url]http://www-ee.eng.hawaii.edu/~dyun/ee160/Book/chap6/section2.1.2.html[/url] >2. Passing 2d arrays, this had just mucked me up. [url]http://www.physicsforums.com/showthread.php?t=270319[/url] and [url]http://cboard.cprogramming.com/c-programming/97898-passing-2-dimensional-array-function.html[/url] >3. Making comparisons between pointers and ints Sorry I did not got this properly to make … | |
Re: Change this line: [CODE=C]saveToFile(*client_file, &client);[/CODE] to this: [CODE=C]saveToFile(client_file, &client);[/CODE] In addition to this, you should also check that the call to fopen() is successful - Salem gave you the code for this check in post #8. Good luck! | |
Re: How about writing a test program to test your assertions? | |
Re: [QUOTE=hket89;959943]Erm, such like syntax error that kind, got what other type of error else?[/QUOTE] What on earth are you talking about? Follow the rules of the forum and ask a proper question. | |
Re: > Hello every one.I coded a program to print current date and time. > First I declare a function tim() to calculate the current time. > It works well.But the problem is I cant call the function from main() function.It doesnt print any thing.What is wrong with this code? > … | |
Re: Help is given to those who help themselves by showing some effort. Perhaps you should post some code. | |
Re: It's no point posting ~500 lines of code and then asking someone to "fix" your code. Make an attempt to post the smallest amount of code that isolates your problem. You never know, by trying to do this you may actually work out what the problem is for yourself. A … | |
Re: In your haste to post your poorly formatted code, you may have missed the opportunity to read the sticky notes at the top of the forum page. In particular, how to ask questions properly and how to format code using code tags. Read these notes and try again. [URL="http://www.daniweb.com/forums/thread78060.html"]http://www.daniweb.com/forums/thread78060.html[/URL] [URL="http://www.daniweb.com/forums/thread93280.html"]http://www.daniweb.com/forums/thread93280.html[/URL] | |
Re: Are you talking about calling Java from C? If so, you'll have to make use of the JNI. I've only done it the other way round - Java calling C through the JNI. Perhaps this article may be useful (it's not for the faint-hearted): [URL="http://java.sys-con.com/node/45840"]http://java.sys-con.com/node/45840[/URL] | |
Re: [QUOTE=notsogood;959377]Hi thanks so much for the other corrections. And.. about the problem, I have been saving my file as filename.cvs.txt all along. So I reverted it to the .cvs extension and there's nothing wrong with the reading. Please declare this thread as solved, but I may post another problem regarding … | |
Re: [QUOTE=katwalatapan;959175]Thank you very much for the prompt reply. It does store the element "putval[0]" in "b[0]", but how should i approach, if I want to return the whole "pulval" array into "b"[/QUOTE] I'm not sure what you're trying to do - seems awfully convoluted for a "long to hex" conversion. … | |
Re: And your question is? Please refer to this link: [URL="http://www.daniweb.com/forums/announcement118-2.html"]http://www.daniweb.com/forums/announcement118-2.html[/URL] While you're at it, as a "newbie", you should read all the sticky posts at the top of the C forum page. | |
Re: [QUOTE=bryangarcia;955809]the user will enter his/her month and day of birth and the program should display the corresponding zodiac sign and the character and personality of the person having that kind of zodiac[/QUOTE] The problem with your code is that your case labels are wrong. Case labels must be some form … | |
Re: Please read the "sticky" posts at the head of this forum. Show some effort (even just a liitle)! [URL="http://www.daniweb.com/forums/announcement118-2.html"]http://www.daniweb.com/forums/announcement118-2.html[/URL] | |
Re: [QUOTE=osei-akoto;952719]Please can anybody tell me the difference in return 0 and system ("pause");[/QUOTE] [B]return 0[/B] means the value 0 (usually some type of int) is returned from a function to the caller of the function. [B]system()[/B] is a library function that makes calls to OS commands/programs. [B]system("pause")[/B] calls the "pause" … | |
Re: Hello, yes it's me again. I cannot believe you. I gave you a full blown working version of what you're looking for and you still keep on insisting on posting versions of the code that don't work. I spent a great deal of time in your PM response (which you … | |
Re: Do you want to actually post the code with regards as to what you want to do? It's blank! | |
Re: Well ... if you have an idea on "how to do it" then post some code or at least a reasonably detailed plan on how you intend on approaching the solution. Code talks ... everything else walks. | |
Re: I gave you a clue to this issue in your thread titled "GOTO command -C". You need to "consume" the '\n' character left over from when scanning the store number. Read my post again in that thread. In your iMenu() function, replace: [CODE=C] scanf("%d", &iSelection); [/CODE] with this: [CODE=C] scanf("%d%c", … | |
Re: [QUOTE=osei-akoto;952688]I have not taught of it yet but i know i have to use gui. After i have know what to do i will then figure it out. Please help me.[/QUOTE] You are "sort of a new programmer" and you want to start out programming GUIs. How about learning some … | |
![]() | Re: You're sort of close. I'm not absolutely clear of your exact requirements (with regards to what to do with word boundaries). Look at the following code. I have hopefully simplified things for you a bit. Bear in mind that this program just outputs exactly "limit" characters per line (except perhaps … |
The End.