-
Began Watching Command Interpreter using C
I want to build an own interpreter using c programming and I want to call it in command prompt. How would i do this? I just want to start a … -
Replied To a Post in Command Interpreter using C
Assuming that the intended syntax is "'display', followed by one or more spaces, followed by the name of the file", you read a line of input, check whether the line … -
Replied To a Post in Object References
You're creating two references to two different `myHuman` objects. If you had two references to the same object (as you would if you did `myHuman person2 = person1` instead of … -
Began Watching Object References
If a object can have multiple references which can have their own state, does this mean that references are also objects themselves? I only ask this because because references have … -
Replied To a Post in Object References
> I only ask this because because references have their own individual definitions of the objects fields that are not shared between other references. What exactly do you mean by … -
Began Watching Why is processing a sorted array faster than an unsorted array?
Here is a piece of C++ code that seems very peculiar. For some strange reason, sorting the data miraculously makes the code almost six times faster: #include <algorithm> #include <ctime> … -
Replied To a Post in Why is processing a sorted array faster than an unsorted array?
> pipelining and branch prediction at the CPU level maybe??? Branch prediction seems like a pretty good candidate. Note that the if condition `data[c] >= 128` will randomly switch between … -
Began Watching function initialisation
Hi, this might be kidish to people over here , am trying to migrate code from c++ to C# where am new to CPP , so guys please help me … -
Replied To a Post in function initialisation
> Abstract classes are sort of the C++ flavor of what is traditionally called "Interfaces" in the Java/C# OOP terminology. I'd say they're the C++ flavor of what Java and … -
Began Watching Pointer
I am confused about pointer , it takes value of a vairable or only takes adress of vairable ?? -
Replied To a Post in Pointer
A pointer is the address of a variable (or the address of an array slot, the address of a struct member etc.). For as long as the pointed-to variable is … -
Began Watching Algorithm Complexity
Hey i read about various Time Complexity Notations. I just wanted to know how big can the C (Constant ) can be . As in Big Oh Notation we say … -
Replied To a Post in Algorithm Complexity
There is no limit to how big the constant can be. -
Replied To a Post in Difference between prefix and post fix operator
> when you put i++ in to a for loop it will add the value of "i" after the compiler has checked the middle comparison statement but will add 1 … -
Replied To a Post in Difference between prefix and post fix operator
> in upper code i++and ++i are also as a statement No, they're not. `System.out.println(i++)` is a statement and `i++` is an expression inside that statement. It's not used as … -
Replied To a Post in EXTERMINATE!!!
If there's no file system entry for a file, it does not consume space. Zeroing the bytes of a file will not make it consume less space, but it will … -
Began Watching EXTERMINATE!!!
path = './file.txt' os.remove(path) import os `os.remove(path)` is equal to `os.unlink(path)`, so how can I delete the file if it just becomes unlinked? Also I haven't tried to yet, but … -
Replied To a Post in EXTERMINATE!!!
> how can I delete the file if it just becomes unlinked? When you say "delete", what exactly do you mean? Scrambling the file? Because when most people say "delete", … -
Began Watching Difference between prefix and post fix operator
postfix and prefix increment or decrement operators very very confusing for me i try my best but i can not understand the basic different between them plz help me i … -
Replied To a Post in Difference between prefix and post fix operator
Because you're using `i++`/`++i` as a statement on its own without doing anything with its value. The side-effects of `++i` and `i++` are the same, only the value differs. So … -
Began Watching Help with compiler implementation - phase 1
Hey there good people. well i have implemented the whole code of compiler phase 1. Have implemented al the DFAs and most are working fine. But this comments DFA is … -
Replied To a Post in Help with compiler implementation - phase 1
Can you explain a bit what you code does any why you think it should do more than discarding one character after it sees a `{`? > You need to … -
Replied To a Post in c incompatible types in assignment
> You are making the wrong typecast One doesn't need to (and arguably shouldn't) typecast the result of `malloc` at all. And much more importantly, `ptr` is still not a … -
Began Watching c incompatible types in assignment
hey guys, so i get the "c incompatible types in assignment" error in the malloc line. would someone please explain where i went wrong? Thank you in advance. #include <stdio.h> … -
Replied To a Post in c incompatible types in assignment
First of all `ptr` is an array (of pointers), not a pointer. So you can't assign to it. Second of all, even if it were a pointer, it wouldn't be … -
Replied To a Post in How to print 2 arrays of same size in parallel?
`zip` accepts more than one argument. And for cases where `zip` does not work, you can always iterate using indices (depending on the situation, using `each_index`, a range or even … -
Began Watching How to print 2 arrays of same size in parallel?
Hello to all, Having to arrays of the same size like below. A = ["SL","MW","OP"] B = ["RU","YF","L2"] How can I concatenate in columns to print in parallel like below? … -
Replied To a Post in How to print 2 arrays of same size in parallel?
To iterate two arrays in parallel, you can use: array1.zip(array2) do |element1, element2| # ... end -
Replied To a Post in How to define large hash at the end of the script
What do you mean it does not work. The output I get when running your code (after removing the "..." in the hash of course) is: 2|0|1|1 This is key … -
Began Watching retaining output window when using #include<stdio.h>
Hey guys,how can i retain the output window when stdio is used as my header? -
Replied To a Post in retaining output window when using #include<stdio.h>
In Visual Studio you can press Ctrl + F5 or Shift + F5 (I don't remember which one) instead of just F5 to run your application in a console window … -
Began Watching syntax error....?
see first elif statement for syntax error, where have i gone wrong?? this is only a section of code, help very much appreciated. if dice == dice2 : print ("The … -
Replied To a Post in syntax error....?
The problem is `c "and the new skill value is"`: there's only a space between `c` and the string - no comma. -
Replied To a Post in How to define large hash at the end of the script
You're calling your parameter `hash`, but trying to access it as `myHash`. I'm also not sure that giving it a default value here is a good idea - it's not … -
Replied To a Post in How to define large hash at the end of the script
def my_method(hash) # ... end hash = { "foo" => "bar", # ... } my_method(hash) Or even: def my_method(hash) # ... end my_method( "foo" => "bar", # ... ) -
Began Watching How to define large hash at the end of the script
Hello to all, I have a ruby script with a very long hash with more than 300 associations. The script looks like below: #!/usr/bin/env ruby Array_A = [] myHash = … -
Replied To a Post in How to define large hash at the end of the script
Put your code in a method that takes the hash as an argument, then define the hash after the method and call the method at the end. -
Gave Reputation to nullptr in I don't understand something in Array
Also, 5 is never counted because arr[5] is out of bounds. -
Began Watching I don't understand something in Array
Hi i was following a tutorial but i stuck at something i don't understand it This is to find out how many times a number appeered inside an array sorry … -
Replied To a Post in I don't understand something in Array
When `i` is 0, we get `arr[num[0]] += 1`. `num[0]` is 1, so we get `arr[1] += 1`. By the same logic we get `arr[4] += 1` when i is … -
Replied To a Post in Def function confusion
Now the body of the loop consists solely of `nr = newrow` - everything else is outside of the loop. -
Replied To a Post in Def function confusion
Are you sure, you're getting the same error? Because from looking at the new code, I'd say you should be getting an indentation error now because you did not indent … -
Began Watching Def function confusion
So i am trying to take some code that i had working before and turn it into a function but every time i run my code it kicks it to … -
Replied To a Post in Def function confusion
As the error message correctly points out, it is indeed not a inside a loop. In fact there is no loop anywhere in your function. -
Began Watching pointer question of function
What does creating a pointer of a function do? I'm not used to getValue being a pointer. char* getValue(char* string); I'm used to something like this. char getValue(char* string); -
Replied To a Post in pointer question of function
Also asked (and answered) [here](http://www.dreamincode.net/forums/topic/345231-pointer-question-of-function/). -
Gave Reputation to mike_2000_17 in why random() is not returning 2?
[Here](http://www.phanderson.com/C/random.html) is the documentation for the random function. It appears that `random(N)` generates a number between 0 and N-1, very much like the more standard `rand() % N` would do. … -
Replied To a Post in why random() is not returning 2?
> Even if I change the number within random() The argument to `random` is *not* the seed. -
Replied To a Post in why random() is not returning 2?
I'm not sure that the seed is really 2 - you don't seem to set a seed anywhere in your code (the docs you showed, don't mention how to set … -
Began Watching why random() is not returning 2?
Hello All Tell me who is correct I or my friend void main() { int GuessMe[4]={100, 50, 200, 20}; int Taker=random(2)+2; for(int Chance=0;Chance<Taker;Chance++) cout<<GuessMe[Chance]<<"#"; } I am testing random() in …
The End.