6,741 Posted Topics

Member Avatar for peacerosetx
Member Avatar for sayeediqbal

What you've posted is not C. Please elaborate on any special libraries or preprocessors you're using.

Member Avatar for Narue
0
80
Member Avatar for NRaf

>The problem is that it appears to be working. Welcome to the world of C. Just because it appears to work doesn't mean it's guaranteed to continue working. >Will pointing to the first element of an array stop the >memory from being unallocated (or whatever)? No. The only reason it …

Member Avatar for Narue
0
106
Member Avatar for death_oclock

Conceptually, calloc works like this: [code=c] void *calloc ( size_t n, size_t size ) { void *mem = malloc ( n * size ); memset ( mem, 0, n * size ); return mem; } [/code]

Member Avatar for death_oclock
0
136
Member Avatar for Drake

>Just need to know what compiling actually does?? The 10,000 foot view is that a compiler takes one language and converts it into another. An assembler in particular takes assembly language code and turns it into machine code.

Member Avatar for tux4life
0
94
Member Avatar for daviddoria

>why would it have gone into an error state? end-of-file counts as an error state in this case.

Member Avatar for daviddoria
0
469
Member Avatar for Hugers

>What next should I go for c# or java? Conceptually they're both largely the same. I'd recommend learning a completely different language from what you're used to, like Haskell or one of the Lisps. You'll get more out of it than learning yet another C derivative.

Member Avatar for Rashakil Fol
0
164
Member Avatar for jayli27

If you keep bumping your thread unnecessarily, I'll close it. Be patient and if someone wants to help, they'll help.

Member Avatar for siddhant3s
0
366
Member Avatar for happygeek
Member Avatar for jbennet
0
616
Member Avatar for erialclaire_238

>And show some freakin effort! >Read your text book!! >I mean please at least TRY. If it's simply a matter of being vague, there's no point in biting heads off when you could just as easily ask for more information, like "what have you tried so far?" or "what are …

Member Avatar for skatamatic
-1
98
Member Avatar for crewxp

>Use fflush(stdin) Bad advice. fflush only has defined behavior for output streams. Passing an input stream is a one-way ticket to a broken program.

Member Avatar for siddhant3s
0
296
Member Avatar for serkan sendur

>However, having multiple exit points for a function makes it difficult to maintain. Forcing a single exit point where it doesn't make sense also makes the function difficult to maintain due to added unnatural complexity. >There is a greater chance that you'll forget to do the clean ups >(which will …

Member Avatar for Narue
0
1K
Member Avatar for serkan sendur

>How does this cheating thing works when you have an actual job? Tell me, I'm curious.. Cheating when the goal of an assignment is to learn only hurts yourself. "Cheating" when the goal is to get a job done helps productivity, though not necessarily quality.

Member Avatar for MosaicFuneral
0
1K
Member Avatar for theighost

>I just made a script that when i give a password, it destroys the >whole site, delete every file. is that enough??? what else can i >do to make sure I get paid. I wouldn't recommend that strategy. You're more likely to get arrested than paid.

Member Avatar for Narue
0
145
Member Avatar for vishy_85

Instead of declaring the buffer locally, pass it to your getcurrentdate function. That way you don't have to worry about returning it: [code=c] #include <sys/time.h> #include <time.h> #include <stdlib.h> #include <stdio.h> char getcurrentdate(char buffer[]); int main(void) { char currentdate[30]; getcurrentdate(currentdate); printf("date is%s",currentdate); } char getcurrentdate(char buffer[]) { struct timeval tv; …

Member Avatar for Narue
0
100
Member Avatar for jibber87

There's not enough code to reproduce your error. Please write a complete sample program that has the error and then post it. >double q[] = norm(pst, y); This in particular is wrong. norm returns a double, not an array of double.

Member Avatar for jibber87
0
155
Member Avatar for jeevsmyd

A lot of words for not a lot of information. :icon_rolleyes: Perhaps you can explain what you mean exactly by "The programming is not termination with a keystroke". I daresay that you're not starting off the right way. Your code is horrible, your choice of compiler is probably not going …

Member Avatar for Narue
0
169
Member Avatar for Mossiah

For the sake of getting you doing the right thing, I'll suggest a mnemonic. Conditional and loop statements can be treated syntactically the same as functions. The "tag" isn't terminated with a semicolon, and the body is surrounded with braces: [code=cplusplus] void reverse(string& st) { int i; int j = …

Member Avatar for iamthwee
0
162
Member Avatar for Mossiah
Member Avatar for Mazor

After you close the file for the first time, the eofbit is still set. You need to clear it with [ICODE]fis.clear();[/ICODE] before the second loop will work. Apparently your Linux compiler chose to clear the state either on close or open.

Member Avatar for Mazor
0
99
Member Avatar for tux4life

>Can someone please give his opinion about the free >available borland compiler, is it good to use nowadays? I assume you're talking about the 5.5 command line compiler, which is good, but it's starting to get dated. The latest and greatest free compiler is a part of Borland's [URL="http://www.turboexplorer.com/cpp"]Turbo C++ …

Member Avatar for tux4life
0
170
Member Avatar for abhi_marichi

>Well I couldn't really make out if you people were against >usage of system library function here in this context. By my reading, death_oclock isn't sure, and ArkM hasn't stated a preference. >If yes could you state the reason...? In this case, system is still risky, but no more risky …

Member Avatar for Narue
0
139
Member Avatar for mimis

There's probably not a tutorial because there's nothing to it. Brute force searching is the dumbest, easiest (and often most inefficient) way you can think of to get the correct answer. In the case of a graph, you'd probably end up doing a recursive traversal of all nodes. Why don't …

Member Avatar for mimis
0
147
Member Avatar for hellIon

>is there something wrong wid this code? Yes. >void main(int argv,char * argc[]) main returns an int. >num1=(int)argc[1]; >num2=(int)argc[2]; For starters, argc is the size of argv. argv is the array of strings. Next, you're expecting a cast to convert "123" to 123, which is not how things work. What …

Member Avatar for Narue
0
156
Member Avatar for rambo123

>i can't understand the increment and decrement of pointer variable. Pointers are an abstraction. Think of it like this: a pointer points to a thing. When you increment a pointer, you tell it to point to the next thing. When you decrement a pointer, it points to the previous thing. …

Member Avatar for csurfer
0
112
Member Avatar for shankhs

>as these both topics are vast and very time consuming Perhaps if you're trying to get a PhD or something in one of them. But as a practicing programmer, you can easily learn enough about both to improve yourself. Learning one topic to the exclusion of equally important topics is …

Member Avatar for shankhs
0
102
Member Avatar for redhotspike

My crystal ball says that you're trying to make it a member function when it should be a non-member.

Member Avatar for redhotspike
0
73
Member Avatar for RexxX

>Right? *crosses fingers* Change "strings" to "things", "structs" to "lists", and you've got it. I'll also direct you to a more detailed reference: [url]http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx[/url] [url]http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_hashtable.aspx[/url]

Member Avatar for Narue
0
151
Member Avatar for ellimist14
Member Avatar for britto

>can u tell me some links which will be useful to me in creating a compiler...... Maybe if you gave us the actual requirements for your assignment. You're confusing a lot of people here by saying you need to write a C compiler in two months, but it only needs …

Member Avatar for MosaicFuneral
0
431
Member Avatar for netveano

C# and VB.NET (probably what your friend meant by VisualBasic) are essentially the same language with a different look and feel. Pick which one you're more comfortable with and go with it.

Member Avatar for Rashakil Fol
0
261
Member Avatar for Rick1980

Unless you care about working out the math for the diminishing size of the inner loop (in which case you shouldn't have any problem with it), the complexity is quadratic because that's the upper bound.

Member Avatar for Rick1980
0
87
Member Avatar for JMChurch25

>I am not the best at it at all by any means Nobody started out knowing what to do and how to do it. We all needed to learn how to solve problems effectively and efficiently. Unfortunately, there's really no shortcut. Mistakes, as they say, become experience. >Is this a …

Member Avatar for Rashakil Fol
0
152
Member Avatar for scarypajamas

>I've been told that Information Technology requires less math then a CS degree. Maybe to get the degree (I wouldn't know, I don't have a degree), but the kinds of jobs you'd get with either a CS or IT degree [I]will[/I] require math. Consider yourself warned. >What worries me though …

Member Avatar for Rashakil Fol
0
204
Member Avatar for Dolphinsfan

[quote] ok, i'm somewhat of a noob to c++ programming and i'm completly lost in my class as of now, i mean i understand the concepts(somewhat) but actually writting my own code is really confusing me, i dont want anyone to give me the answer, but if someone could guide …

Member Avatar for Narue
0
157
Member Avatar for cppStudent

>Why would you ever use a pointer to a pointer? Well, you have to if you ever want to take advantage of command line arguments. In C++ a reference to a pointer would be better if you just need a pointer that can be modified in another function, but pointers …

Member Avatar for Salem
0
89
Member Avatar for rmlopes

>This compiles Probably not cleanly. Check your warnings. >Can someone explain me why does this happen Aside from the fact that you're trying to access a run-time value at preprocessing time (ie. long before it exists)?

Member Avatar for siddhant3s
0
212
Member Avatar for tuse
Member Avatar for peter_budo
0
139
Member Avatar for mushbucket

This is typically where polymorphism is used, but without an idea of the design of your objects, I can't really offer much more than that hint.

Member Avatar for mushbucket
0
202
Member Avatar for nitu_thakkar

When you overload the () operator, it's used as if it were a function call operator and nothing more: [code=cplusplus] #include <iostream> struct foo { void operator()() { std::cout<<"FOO!\n"; } }; int main() { foo bar; bar(); } [/code] If that's not what you want, you're SOL.

Member Avatar for Narue
0
83
Member Avatar for Emerald214

>how much memory does the following take? >const int a[]; >answer: I don't think it is defined. It's quite well defined. You're referring to a function parameter, which (due to the conversion of arrays to pointers) is equivalent to [ICODE]const int *a[/ICODE]. >+ Outside class: It outputs 3 (correct) >+ …

Member Avatar for Emerald214
0
147
Member Avatar for the b

>but I have a dial up connection and dad doesn't like me tying up the phone lines What the hell are you talking about? It's no faster to create a new thread than it is to reply to an existing one. That's a lame excuse for being lazy. >what should …

Member Avatar for DEMWilson
0
183
Member Avatar for Comatose

>I think it should be in the rules, that posting to old threads is a no no. Dani has stated many times that necrobumping is allowed as long as the new post is on topic and can be viewed as a continuation of the discussion. A "me too!" post (where …

Member Avatar for Ezzaral
0
446
Member Avatar for riahc3

>Because I needed 0. Adding zero does nothing. Do you remember your elementary school arithmetic? 1 + 0 = 1 2 + 0 = 2 3 + 0 = 3 ... N + 0 = N

Member Avatar for Rashakil Fol
0
132
Member Avatar for Alice_Blue

A two dimensional array is not a compatible type with an array of pointers. When you pass a multi-dimensional array to a function, the first dimension is converted to a pointer: int[2] becomes int* int[2][4] becomes int(*)[4] int[2][4][6] becomes int(*)[4][6] To properly pass D_2, transpose_mat has to expect either [ICODE]double …

Member Avatar for Narue
0
130
Member Avatar for sid78669

>Can somebody explain why in the code below, when i use free(), it crashes. That's easy. You corrupted the memory and the dynamic memory manager is choking because the corruption removed something it expects to see. A common situation that causes this problem is failing to allocate enough memory for …

Member Avatar for sid78669
0
99
Member Avatar for dmkp

>Say function A() returns a char* which points to a string.. obviously Not obviously. While char* usually denotes a C-style string, there's nothing stopping you from returning a pointer to char where a null character isn't used as a terminator. Keep in mind that C-style strings are defined by the …

Member Avatar for Narue
0
75
Member Avatar for daviddoria

>A friend convinced me to store a vector of pointers in my class What was your friend's reason? Why did you have to be convinced? This sounds a lot like you went against your gut feeling and now you're regretting it. >This just seems like a horrible horrible idea. It's …

Member Avatar for Narue
0
115
Member Avatar for tech2chill

Since your writing skills are so poor, I'm not sure you'll be able to read any of the "gud" ebooks. But on the assumption that you're simply lazy rather than stupid, try [url=http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html]this one[/url]. Also, there's no such language as C/C++. There's C and there's C++, but no C/C++.

Member Avatar for hawkshaw
-1
118
Member Avatar for massivefermion

>it possible to build your own operator with your own definition and your own symbol for every type? Yes, it's called a member function with an informative name. But if you're thinking about creating something like ** for exponentiation or ^^ for a logical exclusive OR, you're out of luck. …

Member Avatar for ArkM
0
92

The End.