6,741 Posted Topics
Re: On the assumption that you're using Turbo C, please make sure that your linker settings include the graphics library. | |
Re: Have you considered a loop? That's generally how we repeat things in C. ;) | |
Re: How many threads are you going to start asking essentially the same question? | |
Re: [QUOTE]I'm getting a error msg: 'cannot convert sprites* to sprite_data** in assignment'[/QUOTE] Your name choices are confusing you. [ICODE]blocks[/ICODE] is defined as being a pointer to [ICODE]sprite[/ICODE], which the error suggests is a typedef for a pointer to [ICODE]sprite_data[/ICODE]. This is very different from the [ICODE]sprites[/ICODE] typedef, which is a … | |
Re: [QUOTE]can i request the moderator to delete an thread i've posted?????!!!!!![/QUOTE] Feel free to report the thread (use the Flag Bad Post button) along with a reason for why you want it deleted/edited and we'll review it. You can always request moderation of any kind, but unless there's a clear … | |
Re: I may have a slightly better idea. Instead of making the new thread button more prominent, how about placing a date check script on the reply buttons? If the thread is older than N days, a nuisance popup could be used. The popup would give posters the option of creating … | |
Re: Links in your signature do not by themselves count as spam. It's only if you post with the sole intention of promoting your signature that they count as spam. This is a difficult pattern to nail down accurately, so if you have links in your signature, you might find otherwise … | |
Re: [QUOTE=Lordvivi;1656616]You can also use this [CODE=c] scanf("%c",&aChar); fflush(stdin); /*It clears the input*/ [/CODE][/QUOTE] No, it's wrong because fflush() is only defined for [U]output[/U] streams. Just because it happens to work for you doesn't mean it's correct. | |
Re: [ICODE]i[/ICODE] and [ICODE]j[/ICODE] will never be equal when the item count is even. You're swapping both halves of the array in that case, which ultimately produces the original sequence. Perhaps instead of using that weird logic for your swapping loop, just use the relationship of [ICODE]i[/ICODE] and [ICODE]j[/ICODE] as the … | |
Re: Find an area with free Wi-Fi. For example, in the United States it's hard [I]not[/I] to find commercial areas (McDonalds, Starbucks, etc...) that offer Wi-Fi as a free service to attract more traffic and hopefully sell product as a result. | |
Re: [QUOTE]I heard if i dont have 3 yrs experience in java i wont be able to get a job easily.[/QUOTE] Given the job market in many places, you may find it hard to get a job regardless of experience. But what you heard is wrong, not all jobs require the … | |
Re: Forgive me if I'm confused, but from the look of your code, you should be well aware of how to calculate the mean from an array (I assume you're talking about the arithmetic mean): [code] #include <math.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 50 double mean(int a[], int … | |
Re: [QUOTE=marirs07;1656111]offsetof cannot be used in this case because u dont know the member's name but only the address of that member :([/QUOTE] Whoever gave you this exercise is either mistaken that it's possible, or expecting a non-portable hack. Either way, you need to get clarification, because within standard C there's … | |
Re: Academic purposes or not, information on exploiting buffer overflows constitutes hacking, which is against Daniweb's rules. I'm sorry. | |
Re: You won't find a book with complete details, the topic is far too broad. | |
Re: [QUOTE]Does every name have to not start with an underscore? Uh.. well yes![/QUOTE] No, but it's a good guideline if you haven't memorized the rules for when and when not to use leading underscores. [QUOTE]It does break the idiomatic use of T and it does not provide a very descriptive … | |
Re: If by "help" you mean "do it for me", kindly go away. Otherwise, please give us some evidence that you've attempted to solve the problem on your own and help will be provided. | |
Re: [QUOTE]i ask this cuz i'm not sure if it's worth learning to use command line arguments or not[/QUOTE] Command line arguments are very simple and worth knowing. For example: [code] #include <iostream> #include <string> #include <vector> int main(int argc, char *argv[]) { // Store the arguments in a more convenient … | |
Re: [QUOTE]And have you understood the format of the file yourself? if so, do you mind explaining it to me.(since OP doesn't seem to interested in explaining that, he has got his own problems).[/QUOTE] It looks to me like an NxN matrix defining the word search followed by the words hidden … | |
Re: If you can suffer the extra storage cost while building the tree, place all of the pointers into an array initially, shuffle the array randomly, [i]then[/i] do the insertion: [code] { std::vector<mesh_t> v(62500); std::fill_n(v.begin(), v.size(), next_mesh()); std::random_shuffle(v.begin(), v.end()); for (auto mesh : v) tree.add(mesh); } [/code] Given a basic binary … | |
Re: [QUOTE]Your instructor will get there eventually.[/QUOTE] If he's lucky. More likely is that his instructor will go through the gamut of lower level and error prone C-style solutions, and only mention the "STL" in passing. | |
Re: >Can't seem to figure this out. You're not the only one. There isn't a portable way to get the size of a dynamically allocated array. You need to pass the size to your function: [code] void addNodes(string names[], size_t size) [/code] | |
Re: There's no prototype in scope for simple_readline() when you use it, and the arguments you provide, while compatible, don't exactly match the definition. The fix is to add a prototype for simple_readline() before main(). | |
Re: That's a very roundabout way of saying you want to validate login credentials. ;) | |
Re: We're not here to do your homework for you. Please show that you've put some effort into doing these exercises on your own. | |
Re: [QUOTE]A character variable largest integer value is 127.[/QUOTE] Assuming CHAR_BIT is 8 and vanilla char is signed. [QUOTE]Once it reaches 127(the character variable) the value will wrap around to the lowest values which is -128.[/QUOTE] That's an implementation detail. The C standard says that overflowing a signed quantity will invoke … | |
Re: You can't change your own name, but if you tell us what you want your named changed to, one of the admins can do it for you (assuming the name isn't already taken). | |
Re: [QUOTE]Basically the time old question of who would win.[/QUOTE] Including the time old mistake of no context. Language comparisons without context are pointless. | |
Re: Note that simply posting a homework assignment is against our rules. We require that you show some effort in solving the problem yourself. | |
Re: Comparison is done with [ICODE]a == b[/ICODE], assignment is done with [ICODE]a = b[/ICODE]. | |
Re: [QUOTE]Can anyone see what I am doing wrong?[/QUOTE] Yes, and I can illustrate the issue in a test program for you: [code] #include <stdio.h> void reset(int value) { value = 123; } int main(void) { int x = 0; reset(x); printf("%d\n", x); return 0; } [/code] [ICODE]value[/ICODE] is a copy … | |
Re: You haven't provided sufficient details about the software requirements. What is "progress"? What information are you logging? How will the logs be used? You mention limited memory, which suggests some form of mobile or embedded device, but the program allows multiple students? Am I correct in assuming that the program … | |
Re: [QUOTE]I need recommendations on a good C book.[/QUOTE] For what purpose? Do you need a good reference? A good beginner's tutorial? Advanced topics? Algorithms and data structures using C? | |
Re: Are we talking about the full range of int, or just the ten decimal digits? The latter is trivial while the former is not. | |
Re: Um...what? Your question isn't clear, please try again. | |
Re: [QUOTE]I was thinking that I either need an if statement or a do while loop but i'm stumped.[/QUOTE] You're thinking in terms of code. Try jumping up a level and think in terms of steps. If you have a bag full of each kind of coin, how would you make … | |
Re: Break it down: [code] int a[5] = { 5, 3, 15, 20, 25 } ; int i, j, k = 1, m ; a[1] = a[1] + 1; i = a[1] ; j = a[1] ; a[1] = a[1] + 1; m = a[i] ; i = i + 1; … | |
Re: [QUOTE]How could I make the input (password) invisible?[/QUOTE] You probably don't really want to make it invisible because that's not as user-friendly as it could be. A generally accepted way to accept passwords is by masking the characters: [code] char *get_password(char buf[], size_t n) { size_t i; for (i = … | |
Re: [QUOTE]Is there a way to do this in c?[/QUOTE] In standard C, the short answer is no. The long answer is that you can do it with a lot of fuss and bother, but ultimately it isn't worth the effort for a weak facsimile of function overloading. The alternative answer … | |
Re: Here's one possible implementation of diwakar's algorithm: [code] #include <ctype.h> #include <stdio.h> int is_finished(void) { char line[BUFSIZ]; fputs("Again? (y/n): ", stdout); fflush(stdout); return fgets(line, sizeof line, stdin) == NULL || toupper(line[0]) != 'Y'; } int main(void) { do { puts("Doing stuff..."); } while (!is_finished()); return 0; } [/code] | |
Re: [QUOTE]I am aware that it can be a slow programming language[/QUOTE] Any programming language can be slow in the wrong hands. Java is notorious for being slow not because it's actually slow, but because it's accessible. Java is easy to learn and it's easier to write complex software without a … | |
Re: Strong bump. I doubt the OP is still around after seven years given his single post. | |
Re: >why is it static? Primarily so that the JVM doesn't have to instantiate your controlling class to get an entry point into the program. | |
Re: get/set methods should be used judiciously. As it is, you could simply make your members public, remove the get/set methods, and the effect would be the same with less code. | |
Re: The language you use is irrelevant as long as it has sufficiently low level access to hook into the necessary information. Traditionally, C, C++, and assembly language have been used for exploits, but I've seen (and written) successful exploits using higher level languages. It's all about having enough power to … ![]() | |
Re: Provided you don't have to deal with a true CSV format with quoting rules, parsing the file is trivial: [code] #include <stdio.h> int main(void) { int value; while (scanf("%d", &value) == 1) { printf("%d\n", value); if (getchar() != ',') break; } return 0; } [/code] Is this what you were … | |
Re: [QUOTE] and also for the code [CODE]int main(void) { int i=0; printf("%d",++i + ++i + ++i); }[/CODE] why output is 7 ?[/QUOTE] It's undefined behavior because you're modifying an object multiple times between sequence points. The output could be anything. [QUOTE]but what about sizeof("A")[/QUOTE] It's the size of an array … | |
Re: [QUOTE]I hope this one works.....[/QUOTE] If you test code before posting it, you wouldn't have to hope. |
The End.