Forum: C 10 Days Ago |
| Replies: 5 Views: 305 scanf("%f", &length);
length is an int, you are passing a float. Same with scanf("%f", &breadth);
Either you change the type in the declaration of length and breadth, or change the f to d in the... |
Forum: C 27 Days Ago |
| Replies: 10 Views: 523 if( line == pattern)
That's a no-no, since line and pattern are strings and you can't compare arrays in that way.
Take a look at the string function strcmp() for that.
However, even if that would... |
Forum: C 27 Days Ago |
| Replies: 6 Views: 351 The controlling expression of a switch shall have integer type.
An array of chars will not do. |
Forum: C Oct 25th, 2009 |
| Replies: 6 Views: 223 Do you know how to open a file and read from it? |
Forum: C Oct 25th, 2009 |
| Replies: 6 Views: 223 One step at a time.
Start learning how to assign values to arrays.
Learn how to read a single or group of characters from a file.
After that it is just a matter of parsing what's read and... |
Forum: C Oct 13th, 2009 |
| Replies: 16 Views: 341 Plenty of thing are erroneous in your snippet, however I would like to point out the cause of your affliction for now.
printf(" A - Addition\n S - Subtraction\n M - Multiplication\n D - Division\n Q... |
Forum: C Oct 12th, 2009 |
| Replies: 28 Views: 1,620 Funny, I thought that was part of the requirement. |
Forum: C Oct 12th, 2009 |
| Replies: 28 Views: 1,620 Perhaps another approach?
#include <stdio.h>
#include <ctype.h>
void clean_spaces(void);
int main(void)
{
clean_spaces();
return 0;
} |
Forum: C Sep 21st, 2009 |
| Replies: 7 Views: 444 Here's an assignment. Search why gets(s[i]); is a no no.
What is it that you are sorting the names by? |
Forum: C Sep 7th, 2009 |
| Replies: 9 Views: 412 priyairani00> "program to swap two no. using third variable" |
Forum: C Sep 7th, 2009 |
| Replies: 9 Views: 412 |
Forum: C Aug 23rd, 2009 |
| Replies: 6 Views: 454 EvilOrange> <--Line 27 - proving the scanf("%s", &tmpfilename) is working
Dealing with the format %s in scanf() you must pass the argument as plain tmpfilename or as &tmpfilename[0], but not as... |
Forum: C Aug 23rd, 2009 |
| Replies: 6 Views: 454 On the phone
Nick: Doctor, can you cure my cough? It is a horrible cough, I cannot sleep at night.
Dr. Hell: Sorry, Nick, I cannot prescribe the proper medication without seeing you first, make an... |
Forum: C Aug 4th, 2009 |
| Replies: 15 Views: 885 no1zson> can somebody look at my IF loop (the first one for selcting 1-3) and see where I am going wrong?
I am sure we can guess what you are trying to do, but don't you think it would be more... |
Forum: C Aug 2nd, 2009 |
| Replies: 34 Views: 1,222 yellowSnow> If this is the case, then perhaps you should try using the strtok() function.
strtok() is a poor designed function, which make this recommendation a poor choice. |
Forum: C Aug 2nd, 2009 |
| Replies: 5 Views: 374 EvilOrange> string[j][0] = string; <-- HERE IS THE PROBLEM
string[j][0] is a space to hold a character
string, on the other hand, is an array of characters. For sure there's going to be a problem... |
Forum: C Jul 9th, 2009 |
| Replies: 16 Views: 867 nonadoes> Only need to extract the number after "_C", "_V", "_S" & "_M"
Search for character _ and when you find it skip one more and that's the number you want. |
Forum: C Jul 8th, 2009 |
| Replies: 16 Views: 867 sscanf() returns EOF if it fails or the number of items that has been successfully read. By using an if statement a minimum of checking has been accommodated. It is imperative to check the return of... |
Forum: C Jun 3rd, 2009 |
| Replies: 7 Views: 307 You are mistaken.
int printf ( const char * format, ... ); is the prototype. You passed it the proper argument. |
Forum: C May 31st, 2009 |
| Replies: 5 Views: 508 file_name is a pointer already to the first character of the array.
You must omit the & or do it as &file_name[0]
The garbage output probably happens because the string is not terminated with a... |
Forum: C May 21st, 2009 |
| Replies: 15 Views: 1,164 sanushks> Thanks! atoi works...
Do you know what happens if atoi fails to convert?
Your first choice of using sprintf was superior, since error checking is better with it. |
Forum: C May 15th, 2009 |
| Replies: 7 Views: 293 lolguy> the removing of the character outside it whish should increment the j to 3 whish should remove E
You are confused. printf("%d",j); is not the subscript used to delete the matched... |
Forum: C May 3rd, 2009 |
| Replies: 2 Views: 740 >Apparently the return value from gets() differs in some way from the return value of fgets() -- enough to break the code as I've written it.
fgets() reads and include the enter key to the string,... |
Forum: C Apr 19th, 2009 |
| Replies: 8 Views: 300 As well as the parameters that it would take if it takes any. Allowing the compiler to check that the function is properly defined.
Let's look at this function prototype then.
int display(int i);... |
Forum: C Apr 19th, 2009 |
| Replies: 8 Views: 300 OP> But when i do it gives me errors on most of my functions saying they 'must return a value', when i void the functions
Do you know what these are at the beginning of the program?
void... |
Forum: C Apr 19th, 2009 |
| Replies: 18 Views: 803 GREAT eBAYER»-(¯`v´¯)-»YOU ‹(•¿•)› POSITIVE w/ 5*-:¦:-THANX-COMEBACK.A++++++++++
[Edit] Oops! Wrong internet. |
Forum: C Apr 19th, 2009 |
| Replies: 8 Views: 300 You know at least this is not C but rather C++, right?
OP> the main errors are in with "for(i=0; i<MAX; i++)" this part of the code but i can't see whats wrong.
for ( i = 0; i < MAX; i++) is... |
Forum: C Apr 18th, 2009 |
| Replies: 18 Views: 803 >sunny╠╠╠╠╠╠╠
>do you know why this is?
Most likely because no null terminator '\0' is finishing the string. |
Forum: C Apr 15th, 2009 |
| Replies: 12 Views: 1,208 Must you? Could we encourage you to change your mind? For the good of the community, please? :D
jephthah, don't worry I'll try to bandage you up afterward. :P |
Forum: C Apr 15th, 2009 |
| Replies: 6 Views: 390 Yes, before my time with the language. And even when I am aware of the difference in defining the function in the old way, I completely missed. |
Forum: C Apr 14th, 2009 |
| Replies: 6 Views: 390 >Any ideas?
That source code is making an easy job extra complicated.
All that is needed.
char *dress_down(char *s)
{
while (*s) {
*s = tolower(*s);
++s;
} |
Forum: C Apr 14th, 2009 |
| Replies: 6 Views: 390 This source code is plagued with syntax errors.
printf ("word: <%s>\n", w); requires the header file stdio.h
int set_keysig (type s, type ks, type init); Prototype missing ; and type, where type... |
Forum: C Apr 10th, 2009 |
| Replies: 11 Views: 702 In the interest of not entering a pissing contest I am going to leave it at that. |
Forum: C Apr 10th, 2009 |
| Replies: 11 Views: 702 While placing prototypes at the beginning of the program, and outside any function, is not strictly necessary, it is a measurement of good practice. Therefore I support the statement of MosaicFuneral... |
Forum: C Apr 10th, 2009 |
| Replies: 11 Views: 702 >what does the above program do with "main"?
A mockery of the C Standard, and a massive example of undefined behavior. |
Forum: C Apr 3rd, 2009 |
| Replies: 3 Views: 292 Any argument passed in the command line is going to be a string as you seems to know. However, casting it to just an int is not going to help. You need to convert that string numeric representation... |
Forum: C Apr 1st, 2009 |
| Replies: 7 Views: 450 I don't know what the function gtk_button_new_with_label() does since it is not prototyped in the code you provide, however, it appears that returns a pointer and not an int.
Making all the errors... |
Forum: C Mar 31st, 2009 |
| Replies: 5 Views: 288 >while(!feof(file))
I glanced very quickly to your last post and saw that.
feof(file) would never give you the expected result as a loop control.
See here (http://www.gidnetwork.com/b-58.html)... |
Forum: C Mar 29th, 2009 |
| Replies: 5 Views: 355 Merge Sort Algorithm Analysis (http://linux.wku.edu/~lamonml/algor/sort/merge.html) |
Forum: C Mar 28th, 2009 |
| Replies: 7 Views: 566 If I understand you correctly, you want to create variables dynamically at run time.
No. It is not possible.
C is strongly typed. Variables need to be declared before hand. |