2,384 Posted Topics

Member Avatar for NejiHyuuga

Reread your text on basic syntax.[code]int words { int words = 1;[/code]It looks like VB. Functions should have a parenthesized parameter list, and it's not a good idea to name a local variable the same as the function.

Member Avatar for manali04
0
189
Member Avatar for daudiam

[URL="http://groups.google.com/group/comp.lang.c/msg/4e0202d03c6291c5"]This is somewhat related[/URL]; I like Chris Torek's explanations of many things: [QUOTE="Chris Torek"]Remember: >>> Precedence and associativity are only for parsing. <<< Do not equate `higher precedence' with `done first at runtime.' >>> Evaluation order is effectively unspecified. <<< Make sure your code does not depend on the actual …

Member Avatar for daudiam
0
241
Member Avatar for Fasola

[I][B]return-value-type[/B][/I] Any value, or none at all, that you want to return from the function: an error code, a calculated result, etc. [I][B]parameter-list[/B][/I] Any value(s) -- or possibly references in C++, or none at all, that you want to pass to the function: a pointer to an array to calculate …

Member Avatar for A.Rehman Amjad
0
1K
Member Avatar for m7r23
Member Avatar for jeevsmyd
0
185
Member Avatar for renar

AD: There's no need to cast away constness (it may do no harm, but I avoid things that can be bad habits). And your integer comparison function can be a victim of integer overflow.

Member Avatar for Ancient Dragon
0
261
Member Avatar for krap_nek

You've got a lot there that needs tweaking. I first found it confusing how you got typos in what would appear to be a copy-and-paste, but I guess what you posted was an intermediate attempt since it wouldn't even compile. After fixing those and ditching the user input for the …

Member Avatar for xwolfjack
0
3K
Member Avatar for adi.shoukat

[url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351]FAQ > Explanations of... > Definition of EOF and how to use it effectively [/url]

Member Avatar for Adak
0
2K
Member Avatar for mhm_ra

Why are you using this form: [INLINECODE](a + i*arraysize +j)[/INLINECODE] rather than subscript notation [INLINECODE]a[i][j][/INLINECODE]? It's simpler, for one, and it is also easier to see that [INLINECODE](a + i*arraysize +j)[/INLINECODE] means the same as [INLINECODE][COLOR="Magenta"]&[/COLOR]a[i][j][/INLINECODE]. Or that [INLINECODE][COLOR="Magenta"]*[/COLOR](a + i*arraysize +j)[/INLINECODE] means the same as [INLINECODE]a[i][j][/INLINECODE]. So what you …

Member Avatar for peter_budo
0
202
Member Avatar for scott_6169

>If anyone can help me i would greatly appreciate it. [url="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043803465&id=1043284385"]Sure[/url].

Member Avatar for Ghazanfar Ali
1
204
Member Avatar for Don_k

[QUOTE=Smitha Renny;1125877]Hi As you have said, it is the logic you have used. There is a slight modification I have made in your program and it will show a vowel only as a vowel. Here it is:[/QUOTE] Did you not understand the logic behind using isalpha and toupper, or did …

Member Avatar for eilans_10
0
158
Member Avatar for ASardinia1
Member Avatar for Saxo

Please read the [url=http://www.daniweb.com/techtalkforums/announcement8-2.html]Announcement[/url].

Member Avatar for meandmyself
-2
525
Member Avatar for ashish2234
Member Avatar for genie0582
0
310
Member Avatar for prabindatta

[code] struct amicable* record; /* allocate array of pointers */ record->amicablePair=(int**)malloc(nrows*sizeof(int*));[/code]record needs to point to something before you dereference what it points to with the -> operator.

Member Avatar for arpit1109
0
116
Member Avatar for Veer

[QUOTE=Veer]3. for that you will have to keep track of all the required information, ex. - real min/max - absolute min/max - absolute sum The problem is I can not use "Array". and i dont know how can i declare 25 numbers?? thts why im confuse[/QUOTE]Input your values to a …

Member Avatar for camie_yeye
0
146
Member Avatar for Alfarata

[QUOTE=Alfarata]I need to read in a csv file created by MSExcel into an array. The file contains 750 rows of 5 sets of numbers some int. some float. the format looks like this: [code]301,36,0.285,2.88,15.000 302,88,0.247,2.88,75.500[/code][/QUOTE]To me it sounds like you'd want to read a line as a string using [FONT=Courier …

Member Avatar for sinju
0
153
Member Avatar for Ancient Dragon

What I find funny is that the worst epithets that apply to Palin apply equally if not moreso to Obama. Keep 'em coming!

Member Avatar for johnnybgood
0
450
Member Avatar for Sukhbir

"[url="http://www.eskimo.com/%7Escs/C-faq/q3.2.html"]The behavior of code which contains multiple, ambiguous side effects has always been undefined[/url]".

Member Avatar for sanagopi
-1
235
Member Avatar for wingwarp
Member Avatar for Ancient Dragon
0
150
Member Avatar for nsavvinv
Member Avatar for frodothehobbit
0
6K
Member Avatar for AhmedHan

[QUOTE=AhmedHan]So, is that the fault of sizeof() or the structure really holds 56 bytes? I am gonna use this structure to gether the header of a bitmap file. My question is, am I gonna get 54 bytes or 56 bytes by a file stream function such as .read() ?[/QUOTE]What [FONT=Courier …

Member Avatar for bala2nd
0
361
Member Avatar for jasweb2002

Go to the last line of the file, to the last character in the line, and hit return/enter.

Member Avatar for Jean <Brasil>
0
399
Member Avatar for Dave Sinkula

Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not …

Member Avatar for Aia
0
1K
Member Avatar for harshchandra

# include<alloc.h> - is nonstandard #include<conio.h> - is nonstandard void main() - is incorrect ch=(char*)malloc(20) - the cast is unnecessary, you should check the return value clrscr(); - nonstandard function gets(ch); - never use gets()! return 0; - returning a value from a void function?

Member Avatar for Nick Evan
-2
264
Member Avatar for Dave Sinkula

Never use the function [inlinecode]gets[/inlinecode]. Why? It is unsafe. Since the maximum string size cannot be specified, it is always susceptible to buffer overflow. This snippet shows one way to do a safe version of [inlinecode]gets[/inlinecode]. It reads characters from the [inlinecode]stdin[/inlinecode] into a string up to the specified size …

Member Avatar for Narue
0
2K
Member Avatar for dalaharp

[QUOTE=dalaharp]i have attached a file, where the first step of gabor filter is detailed (a point to note: i am implementing gabor for fingerprint image processing) and this is how i coded it.. just see if there are no technical errors in it..[/QUOTE]We can't really do that because you are …

Member Avatar for hayat alazzeh
0
1K
Member Avatar for Dave Sinkula

Just to measure this site's preferred candidates, but possibly to stir up another hornets nest. :D [url=http://en.wikipedia.org/wiki/United_States_presidential_election%2C_2008]More info[/url]. [I]The poll had a limit of 10 items. There are more R's than D's because [B]I[/B] made this poll and because that side is more contested.[/I]

Member Avatar for jephthah
0
6K
Member Avatar for kohkohkoh

[code] int age;[/code]You have [i][font=Courier New]age[/font][/i] declared as a single [font=Courier New]int[/font], but later try to operate on it as if it were an array of [font=Courier New]int[/font]s, which it is not.

Member Avatar for peter_budo
0
147
Member Avatar for letmec
Member Avatar for diafol

[QUOTE=ardav;1150525]Is it me or are there loads of members reanimating long-expired threads? [/QUOTE] I read "members" as those who've been here for a while. Isn't it more likely that someone just registered and responds to some 2-year-old question, though? Just a different variant of the fly-by/on-off poster. [QUOTE=ardav;1150525]Is there a …

Member Avatar for diafol
1
716
Member Avatar for nnhamane

You've got an extra [INLINECODE]}[/INLINECODE] at then end of [I]solve[/I], right before [I]check[/I].

Member Avatar for peter_budo
0
2K
Member Avatar for liliafan

[url="http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=8m9jdm%2498c%241%40bob.news.rcn.net"]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=8m9jdm%2498c%241%40bob.news.rcn.net[/url]

Member Avatar for Narue
1
317
Member Avatar for cblue

[QUOTE=marinme][code]void FillMyArray(int ArrayToBeFilled[], int TopValueToBeInserted) { for(int i = [COLOR=Red]1[/COLOR]; i<[COLOR=Red]=[/COLOR]TopValueToBeInserted;i++) { ArrayToBeFilled[i] = i; } }[/code][/QUOTE]The usual (and correct) idiom is like this.[code]for(int i = [COLOR=Blue]0[/COLOR]; i [COLOR=Blue]<[/COLOR] TopValueToBeInserted; i++)[/code]An array of size N is indexed from 0 to N-1.

Member Avatar for jai verma
0
246
Member Avatar for jephthah
Member Avatar for cwarn23

With all due respect, "mods don't want to moderate" is a lame excuse. Maybe recruit mods from people who are both knowledgeable in the forum in question AND those who want to play janitor (rather than simply being a frequent poster?)?

Member Avatar for jephthah
0
168
Member Avatar for matika

C or C++? The C solution is [font=Courier New]qsort[/font], and the only difference from what was already shown is the comparison function you write. In C++ there is a [font=Courier New]std::sort[/font].[code]#include <iostream> #include <vector> #include <algorithm> typedef std::vector<std::string>::iterator iter; typedef std::vector<std::string>::const_iterator citer; void Show(std::vector<std::string> &alist, const char *label = "") …

Member Avatar for sachin_mnnit
1
760
Member Avatar for jephthah

[QUOTE=jephthah;1163775]here is the NOW BULLETPROOF(*) version that i should have posted in the first place (* Nearly) [code] char *tempDate, *mmStr, *ddStr, *yyStr, *ptr; int error = 0; tempDate = malloc(strlen(dateString) * sizeof(char)); strcpy(tempDate,dateString); // copy dateStr into temp location that can be abused by strtok [/code] .[/QUOTE] Isn't that …

Member Avatar for Dave Sinkula
0
157
Member Avatar for Kushal Thakkar

Uh. Follow the links posted already in the thread? (Try not to be an unthinking idiot who is not inclined to read the replies already posted here.)

Member Avatar for Dave Sinkula
0
2K
Member Avatar for Fbody

Using char or short for bitfields is a non-standard extension. Prefer doing the shift-and-mask yourself with an unsigned type.

Member Avatar for Dave Sinkula
0
378
Member Avatar for tajendra

[QUOTE=tajendra;1152520]2) Don't use specific system constant. System specific constant should not be used as they are not portable, we are some time not aware of them also. Like system constant "NULL" is specific to windows and will give compilation error on other platform. Instead of "NULL" one can use "0". …

Member Avatar for tajendra
0
469
Member Avatar for mebob
Member Avatar for Spiderpig085
Member Avatar for abhimanipal
0
171
Member Avatar for ButchMeatcook

main.c:55: warning: passing arg 1 of `load_MPN_table' from incompatible pointer type main.c:66: warning: char format, different type arg (arg 2) main.c:50: warning: unused variable `row'

Member Avatar for ButchMeatcook
0
3K
Member Avatar for shoby

Off the top -- watch out for unintended assignment. [code]while ( counter= 0 )[/code]Comparison is [INLINECODE]==[/INLINECODE].

Member Avatar for jmsDC
0
469
Member Avatar for netraven5000
Member Avatar for dumbncool

[QUOTE=dumbncool;1155695]Inside a C function, if I declare something like [icode]char *s = "Hello";[/icode] Where will the memory for the "Hello" string be allocated? Will it be on the stack or the heap?[/QUOTE] Neither. [url]http://c-faq.com/aryptr/aryptr2.html[/url]

Member Avatar for dumbncool
0
169
Member Avatar for Soileau

Another link: [url=http://www.daniweb.com/tutorials/tutorial45806.html]User Input: Strings and Numbers [C][/url]

Member Avatar for Dave Sinkula
0
4K
Member Avatar for Ca67

Using a subscript operator implies a container of some sort: an array, a vector, a linked list, etc. [URL="http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.12"]Subscript operators often come in pairs[/URL]. In your case, x, y, and z might be seen as elements to your "container" -- to which elements 0, 1, and 2 might be subscript …

Member Avatar for Dave Sinkula
0
121
Member Avatar for habib_parisa

[QUOTE=habib_parisa;1152545]By the way, why your formula does not work when the malloc is used in a separate line like this: [CODE]double (*tree)[50]; (*tree)[50] = malloc( 50 * sizeof(*tree) ); [/CODE][/QUOTE] As declaration + statement, it would be like this: [CODE] double (*tree)[DIM]; [COLOR="Red"][B]tree [/B][/COLOR]= malloc( DIM * sizeof(*tree) );[/CODE] (Pay …

Member Avatar for Ancient Dragon
0
143
Member Avatar for theonlywalks

You're using sscanf as if it were fscanf. You can make the two behave similarly, but sscanf will need different directives and variables.

Member Avatar for Dave Sinkula
0
133

The End.