| |
thread by: ajba74 |
last post Apr 15 '07 by: David Thompson
Hi fellows,
I am reading some books to learn the C programming language, and
sometimes I have the feeling that when somebody becomes a C expert, he
must learn a more modern and object-oriented language.
When I read things like "... C++ is an evolution of C ..." or "... C
is a subset of C++ ..." I tend to believe that I will have to learn...
|
thread by: lovecreatesbea... |
last post Apr 14 '07 by: =?utf-8?B?SGFyYWxkIHZhbiBExLNr?=
Do you prefer malloc or calloc?
p = malloc(size);
Which of the following two is right to get same storage same as the
above call?
p = calloc(1, size);
p = calloc(size, 1);
|
thread by: C C++ C++ |
last post Jun 27 '08 by: James Kanze
what is an escaping variable?
|
thread by: suresh |
last post Jan 4 '08 by: James Kanze
Hi,
For this code snippet, I get the following output, which I am unable
to understand.
(2^31 = 2147483648)
cout<< -2147483648 << endl;
cout << numeric_limits<int>::min() <<',' <<
numeric_limits<int>::max()<< endl;
|
thread by: junky_fellow |
last post Jan 28 '08 by: pete
Hi,
Is there any efficient way of finding the intesection point of two
singly linked lists ?
I mean to say that, there are two singly linked lists and they meet at
some point. I want to find out the addres of the node where the two
linked intersect.
thanks for any help...
|
thread by: mattia |
last post Apr 11 '08 by: lawrence.jones
I've see in some code:
#ifdef __cplusplus
extern "C"
{
#endif
what does it mean?
Thanks
|
thread by: Carlo Milanesi |
last post Jun 27 '08 by: Alisha
Hello,
traditionally, in C++, dynamically allocated memory has been
managed explicitly by calling "delete" in the application code.
Now, in addition to the standard library strings, containers, and
auto_ptrs, gurus suggest that may be better to use a reference-counted
smart pointer, or a garbage-collector.
But in which cases it is better...
|
| |
thread by: aarklon |
last post Jun 27 '08 by: Keith Thompson
Hi,
the following is actually a part of the pattern matching program which
i tried ,memset is not setting the entire integer array with
-1
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
|
thread by: Bill Cunningham |
last post Jun 27 '08 by: Keith Thompson
I have heard that return -1 is not portable. So what would be the answer
to portability in this case? What about exit(0) and exit (-1) or exit (1)?
Or would it be best to stick with C's macros, hence:
exit(EXIT_FAILURE)
exit (EXIT_SUCCESS)
Bill
|
thread by: Kenny O'Clock |
last post Jun 27 '08 by: lawrence.jones
This came up in a job interview, what is the output of the program
below? I tried to compile and run it myself, but my compiler (lcc-win32)
aborts with this errors....
Warning test2.c: 3 old-style function definition for 'main'
Warning test2.c: 3 missing prototype for 'main'
Warning test2.c: 3 '
Error test2.c: 3 compiler error in...
|
thread by: Jamie Burns |
last post Jul 19 '05 by: lilburne
Hello,
I realise that I just dont get this, but I cannot see the need for auto_ptr.
As far as I have read, it means that if you create an object using an
auto_ptr, instead of a raw pointer, then the object will get cleaned up when
the method/function ends. Isn't this what happens if you just declare an
object without using a pointer at all?...
|
thread by: Steven T. Hatton |
last post Jul 22 '05 by: Bjarne Stroustrup
This is a purely *hypothetical* question. That means, it's /pretend/,
CP. ;-)
If you were forced at gunpoint to put all your code in classes, rather than
in namespace scope (obviously classes themselves are an exception to this),
and 'bootstrap' your program by instantiating a single application object
in main(), would that place any...
|
thread by: Pat |
last post Jul 22 '05 by: Bill Seurer
Hi,
1. Any faster method (other than for-loop) to initialize array?
2. Does there have similar C++ function to replace C's "fprintf"?
Thanks.
Pat
|
thread by: Matt Parkins |
last post Jul 23 '05 by: Ivan Vecerina
Hi,
(I realise this probably isn't precisely the right group for this - could
someone direct me to the appropriate group to post this question? - thanks
!)
I'm using Visual C++ 2005 Express Edition Beta (free download from MS -
hooray!), and everything works fine, except I get warnings back on the use
of some functions, strlen() for...
|
thread by: Curt Geske |
last post Nov 13 '05 by: Mike Wahler
I'm suprised no one suggested a union!
#include <stdio.h>
union _x
{
long lng;
char byt;
} X;
void main( void )
|
| |
thread by: Debashish Chakravarty |
last post Nov 14 '05 by: Dan Pop
K&R pg.66 describes two situations when using goto makes sense. Has
anyone here come across situations where using goto provided the most
elegant solution.
--
http://www.kashmiri-pandit.org/atrocities/index.html
|
thread by: OcelotIguana |
last post Nov 14 '05 by: Mark McIntyre
Hello,
Does anyone have any suggestions for where to find a good sincos
routine (i.e. a routine that calculates both the sin and cos of a
given argument) written in c?
Thanks,
OcelotIguana@yahoo.com
|
thread by: Serve Laurijssen |
last post Nov 14 '05 by: Michael Wojcik
Some people prefer to use
"if (x & 1)"
to see if a number is odd or even. Is this completely portable according to
the standard?
|
thread by: Rakesh |
last post Nov 14 '05 by: Christopher Benson-Manica
Hi,
I have this function to reverse the given string.
I am just curious if that is correct and there could be better way of
doing it / probable bugs in the same.
The function prototype is similar to the one in any standard C
library.
<---- Code starts -->
|
thread by: Alex |
last post Nov 14 '05 by: Stephen Sprunk
I know this is a religious issue, and I hope this thread doesn't degenerate,
but I am curious about the pros and cons of swapping the operands of ==.
The only pro of putting the constant on the LHS that I know of is that it
protects against an accidental assignment where a test for equality was
intended.
But the advantage above only...
|
thread by: JaSeong Ju |
last post Nov 14 '05 by: Michael Wojcik
I would like to overload a C function. Is there any easy way to do this?
|
thread by: Priya Mishra |
last post Nov 15 '05 by: Suman
What is wrong in the below code,
I get the 2 error when i compile the prog... what is mean ??
error C2275: structure: illegal use of this type as an expression
error C2065: str: undeclared identifier
typedef struct
{
|
thread by: Anthony Irwin |
last post Nov 15 '05 by: Flash Gordon
Hi,
I am fairly new to C and all the C books I got talk about gets() but when
I compile it says I should not use gets() because it is dangerous. I
understand that it is dangerous because it doesn't check whether there is
more characters entered by the user the what can be stored but I don't
know what the safe equivalent of gets() is.
...
|
| |
thread by: Lindsay |
last post Jan 16 '06 by: Neil Cerutti
I was just reading another post when someone commented that the code was C
and not C++. What are the differences? (Examples?) The answer does not
affect my programming but would help to know if I need to post a question.
|
thread by: Ajay |
last post Mar 25 '06 by: Vladimir S. Oka
Hi all,can you please tell the most efficient method to reverse a
byte.Function should return a byte that is reversed.
|