78 Posted Topics

Member Avatar for ram619

float prod() is not a prototype, it's merely a declaration. float prod(int, float) is a prototype. As you have it declared, prod() returns int. You'll need to declare it otherwise in order to use it the way you want to. Also, the usual: <conio.h> is obsolete and nonstandard, main returns …

Member Avatar for lisaroy1
0
387
Member Avatar for tiuwulf

[code] mt = (mytype*)calloc(1, sizeof(mytype));[/code] Better is [code] mt = calloc(1, sizeof *mt);[/code] 1) don't cast the result of malloc() (and friends), because all it does is hide a useful warning; and 2) [icode]sizeof *mt[/icode] is shorter than [icode]sizeof(mytype)[/icode], and you don't have to change it if you later change …

Member Avatar for tiuwulf
0
91
Member Avatar for lochnessmonster

There are really two answers to this question: 1) yes and 2) no. Yes, because the cast in this case does no more than make an implicit conversion explicit. It is the same if you do [icode]float x = 12;[/icode] -- you don't need to write [icode]float x = (float)12;[/icode] …

Member Avatar for Trentacle
0
152
Member Avatar for udaykrishnag

[QUOTE=udaykrishnag;1432819]to find the size of image by knowing the height and width....and by knowing the pixel depth...any solutions plz help.....[/QUOTE] What do you mean by "size"? In what units do you intend to measure such a quantity?

Member Avatar for Trentacle
0
42
Member Avatar for trust_noone

"i researched about threading but it's too complicated for me" Translation: "I don't feel like doing real work, can somebody pretty please solve my problem for me?"

Member Avatar for Trentacle
0
92
Member Avatar for hsetaknev

Your first and most obvious error has been mentioned already. Since you haven't said otherwise, I'm assuming you fixed that error, and since you haven't kept complaining, I'm assuming that fixed your problem. If that's the case, could you mark this thread solved? If you're still experiencing difficulties after fixing …

Member Avatar for Trentacle
0
155
Member Avatar for DJSAN10

[QUOTE=DJSAN10;1427307]If the main() takes 3 arguments i.e. int argc,char * argv[],char *env[] and SINCE C DOES NOT SUPPORT FUNCTION OVERLOADING ,y does the c compiler does not give error for simply void main() //that is no arguments at all OR void main(int argc,char *argv[]) //2 arguments[/QUOTE] There are two things …

Member Avatar for DJSAN10
0
195
Member Avatar for onus

I'm not seeing any errors... compiles and runs fine, giving meaningful output. It's rather more verbose and less useful than `ls -F`, though. ;) Do you want to change the way the output is printed? I'd prototype main(), give some thought to the 20-character limit, and use fgets for user …

Member Avatar for Trentacle
0
232
Member Avatar for vedro-compota
Member Avatar for vedro-compota
0
188
Member Avatar for neo2nate

[QUOTE=cool_zephyr;1424587]1. open a pointer to a file 2. read the bytes till the end of file using fread() 3. close the pointer[/QUOTE] I can do you one better: 1. Find a forum that discusses C++. 2. Don't append your question to a 4.5 year old thread. 3. Do some research …

Member Avatar for Trentacle
0
624
Member Avatar for omkar1987

I beg to differ. malloc is defined in some implementation-defined library and declared in <stdlib.h>.

Member Avatar for Narue
0
173
Member Avatar for vedro-compota

Interactively, use fgets() to get a line, then strtol() to convert it to a long. If you're reading from structured input, use scanf(). @alexchen: C is not the same as C++. Please take that cin nonsense somewhere else.

Member Avatar for vedro-compota
0
248
Member Avatar for phobos666

If you're using Cygwin, it's probably best to say it upfront -- avoids confusion. For clarification, can you tell us whether fopen returns NULL when you open the file in a subdirectory?

Member Avatar for phobos666
0
304
Member Avatar for anraevlus18

[QUOTE=anraevlus18;1418567]Hi Manimuthu, Thanks for your reply..But this logic even i have tried. I wanted to use one single grep command for both operations. Is there a way to do this?[/QUOTE] My advice? Don't bother, unless it's a serious performance barrier (in which case I suspect you wouldn't want to keep …

Member Avatar for d5e5
0
264
Member Avatar for Daita
Member Avatar for Daita
0
148
Member Avatar for atoklas

Every integer you pass to printf is sizeof(int) in size, unless it promotes bigger -- you can't pass anything smaller. The only way to print a 24 bit object is to write your own routine with putchar(). OTOH, you could use 3 chars.

Member Avatar for Trentacle
0
260
Member Avatar for terabyte

[QUOTE=terabyte;1414823]Thanks I will give it a look. [...] That is why I'm learning Perl[/QUOTE] Good choice, on both counts p.s. I also recommend K&R, but I'm not sure what other books would be advisable. Most of my knowledge comes from lurking in comp.lang.c

Member Avatar for Trentacle
0
180
Member Avatar for dcarrawa

Google suggested [url]http://docstore.mik.ua/orelly/perl/prog3/ch21_04.htm[/url] There's a chapter about this topic in [i]Programming Perl[/i] IIRC, but my copy is in another state, so I can't look it up atm.

Member Avatar for dcarrawa
0
254
Member Avatar for murtazamzk

It's not too difficult. count is just a distraction. b starts at 10 and increments until ugly_string[b + 21] is 0. So the useful part of the string is from ugly_string[31] to the end; the first 31 chars are padding just to obfuscate it. a is set to the next …

Member Avatar for Shankye
0
192
Member Avatar for gaurav_13191

[QUOTE=ravenous;1418608]Also, you don't need [code] struct stacktype s1; [/code] on line 62, you can just use [icode]stacktype s1[/icode].[/QUOTE] Only in C++. Please don't do that in C.

Member Avatar for gaurav_13191
0
183
Member Avatar for arash_total
Member Avatar for amari ♥

[QUOTE=alexchen;1418616]1 [CODE]int *list int main(){ list=new int[size]; for(int i=0;i<size;i++){ list[i]=0; cout<<list[i]<<endl; } } [/CODE][/QUOTE] That's not C.

Member Avatar for Trentacle
0
127
Member Avatar for arshi9464

Two words for the same thing. I'm sure there are some people who draw differences and say "it's only an emulator if it does this", etc., but there's no official rule. I tend to use "simulation" to refer to hardware, like a flight simulator, and "emulation" to refer to software, …

Member Avatar for Trentacle
0
49
Member Avatar for Joey_Brown

Well, it's not [I]really[/I] a two-dimensional array -- it's a pointer to (the first element of an array of) pointer to (the first element of an array of) short. The comp.lang.c FAQ, [URL="http://c-faq.com/aryptr/index.html"]section 6[/URL], might help you understand, especially question 6.16.

Member Avatar for Trentacle
0
151
Member Avatar for lmytilin

Here's what my first-guess algorithm looks like: 1. Start copying characters from name to newName, keeping track of the number of spaces you encounter. 2. When you encounter the (m-1)th space, copy the remaining characters up through the (n-1)th space into a temporary buffer. 3. Copy the nth word from …

Member Avatar for myk45
0
2K
Member Avatar for omkar1987

Postfix operators bind more tightly than prefix operators. Therefore your [icode]*length++[/icode] gets parsed as [icode]*(length++)[/icode], which has undefined behavior because length + 1 isn't a pointer to the same object.

Member Avatar for WaltP
0
124
Member Avatar for garevn

I don't know where to start. Are you using C or C++? You can't use <iostream> in C, but "delete" is a reserved word in C++. Neither language has <conio.h> (which is an archaic and non-standard header) or void main(). Your input problems are something else altogether, but you need …

Member Avatar for Trentacle
0
344
Member Avatar for manish250

[QUOTE=manish250;1413744]dear all i am new to perl. when i run my basic perl program as follows[CODE]print<<EOF; HELLO MY NAME IS MANISH ARORA EOF[/CODE] i am getting this error Can't find string terminator "EOF" anywhere before EOF at PERL.plx line 1. please help[/QUOTE] Sounds like there's a stray space after the …

Member Avatar for manish250
0
176

The End.