• Member Avatar for sepp2k
    sepp2k

    Replied To a Post in instance method

    > If static modifier is not applied before does it makes it an instance method ? Yes.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching File.length() keeps returning 0

    I need to get the size of a file, but I keep on getting 0 as the size, which is not the actual size. private void dodAlgorithm() throws IOException { …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in File.length() keeps returning 0

    You check the file size after you've already opened the file for writing. Since opening a file for writing creates an empty file with that name (overriding the existing file …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in for loop and pointers, Error

    It is indeed better to use `printf("%s", message)` than `printf(message)`, but only because it prevents problems if the string contains characters that have special meaning to `printf` (like `%`), which …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in for loop and pointers, Error

    By providing the flags mentioned in the error message: `-std=c99` for standard C99 mode or `-std=gnu99` for C99 with GNU extensions. For C++11 mode just replace 99 with 11.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching **segmentation fault 11** problem

    Goodevening, I'm starting coding in C and I've done a little program to understand "struct" function, but... I receive this message: Segmentation fault: 11 I've understood a bit what this …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in **segmentation fault 11** problem

    Your joueur array holds only one element, but your index goes up to `1` (which would be the second element), which is out of bounds.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching for loop and pointers, Error

    [Linux & gcc] I'm taking C courses and pluralsight.com and I'm both getting an error with a program I got from one of their videos as well as having some …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in for loop and pointers, Error

    > When I try to compile this program in gcc I get this error As the error message says, you need to supply the mentioned language options to make the …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching AP Computer Science(Java) Question

    I'm in AP Computer Science A* I was doing the following problem: int i = 1; while ( i < 10 ) { int j = 10; while ( j …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in AP Computer Science(Java) Question

    To tell you where you went wrong, it'd be good to know how you got to ten. For each iteration of the outer while loop what's the value of `i` …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching pseudo code to assembly code

    consider the following pseudo code and write the corresponding assembly code for it. Note: There is more credit for a shorter code. If (al > C1) AND (b1 > a1) …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in pseudo code to assembly code

    > i can`t understand this code.... It stores the number `1` in the variable `dx` if the number stored in the variable `a1` is greater than that in the variable …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching print won't execute

    Hey guys, I am a bit confused here ... making a script to brute force through a dictanary the password of a zip file and it seems to work fine …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in print won't execute

    Did you create the text file on Windows? If so, it probably uses `'\r\n'` as the line ending, so after stripping the `'\n'`, the passwords will end up as `'password\r'` …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching which one is faster?

    int find(int x) { for(int i=0;i < n; i++) { if(a[i]==x) return i; } return -1; } int find(int x) { for(int i=0;i < n/2; i+=2) { if(a[i]==x) return i; …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in which one is faster?

    The third is almost certainly the fastest (and the second the second fastest) as it only iterates over a third of the array (and the second over half). However this …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching break one char into two

    Hey, I would like to break one char for example "t6" into to chars t and 6 look at what i did... int a,b; temp = *arraystr[2] % '10'; a …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in break one char into two

    As NathanOliver said, "t6" isn't a char, it's a char array. To get 't' and '6', you can simply access them as `"t6"[0]` and `"t6"[1]` respectively.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching a curiosity about const

    Hello, Can someone, please, comment on the following curious fact that I encountered in C (actually, I use gcc, which has the default language Gnu C): If one writes const …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in a curiosity about const

    This has nothing to do with `const`. If you remove the `const` keyword from your program, you'll get the same error. The problem is that the initializer for a global …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Strange program compiles

    This program goes against everything I have been taught and learned in C. How does this compile? Why does this not need to be int main? Why no return 0? …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Strange program compiles

    Also asked (and answered) [here](http://www.dreamincode.net/forums/topic/359353-strange-program-compiles/).
  • Member Avatar for sepp2k
    sepp2k

    Began Watching zork & adventure python script

    Alright. I'm teaching myself python from 'Learn Python the Hard Way: 3rd Edition' by Zed Shaw.. it's been informative so far. Definitely learning. After his lessons, he gives study drills, …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in zork & adventure python script

    What you posted does not look like source code, it looks like what you might see when you open a binary file in a text editor. Presumably you downloaded the …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Confused with functions

    > use 'out' parameter There's no such thing in C++.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Confused with functions

    Okay so first is I am confused with the void function. It is said that void function does not return a value. If for example I have a void function …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Confused with functions

    A `getUserInput` function simply can not be sensibly defined with that signature. It either has to return something other than void or it has to take its parameters by reference …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in o notation problem

    O (and o, which the OP asked about) describes the growth of a function. That function often describes the running time of an algorithm, but that's not important here. A …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Split function confusion

    I'm not sure what's left to be explained. In your example the third case calls split with zero as the second argument and in the fourth case you call it …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Split function confusion

    /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; class Test{ public static void main(String args[]){ String Str = new String("WelcometoTutorialspoint.com-"); int i=0; System.out.println("Return …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Split function confusion

    From the Java docs (emphasis mine): > If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Pattern returns only first occurence

    Hello, I have a string which consists of tokens enclosed in square brackets []. I need to identify these and process the string to replace them with some other derived …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Pattern returns only first occurence

    You're only getting one occurence because you're only calling find once. If you use a while-loop instead of an if, you'll call it until it returns false, which will give …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in how do i write ....

    Use an `if` to check whether you're in the last iteration (i.e. whether `i == x`). If you are, don't print a space after the number, otherwise do.
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in how do i write ....

    "separated" means that the space should be between the numbers. Your code also adds one space after the last number, which is probably not allowed.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching how do i write ....

    there's a problem on Codeforces.com (it's for beginers) which i know it's solution but my code can't be accepted because there's a condition that i don't know how to write …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in how do i write ....

    `1 <= X <= 10` isn't a condition that you're supposed to check in your code. It's just telling you that X will be in that range, so you can …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in o notation problem

    > I just understood that big O is an asymptotic notation and used to classify algorithms according to their response time and memory they take. and I have no idea …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    If the implementation of `array` uses a pointer to dynamically allocated memory (which is pretty much a given unless there's some static maximum size for `array`s) and the memory that …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    > If this is what you are trying then what you have written wont necessarily work, it rather depends on the implementation of bytearray, whether it holds the actual data …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    Assuming that the pointer points to a correctly initialized instance of type `bytearray` and the `bytearray` class is correctly assignable (creating an independent copy that will still be usable once …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    Well, if the class is correctly defined (which one can assume if it's part of a library that you were given), I told you what the most likely problem is. …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    So you did post in the wrong forum. And `array` is your own class, right? Because `std::array` would require two template arguments. In any case, assuming that your array class …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching o notation problem

    Let a be any positive number. Show that a^n = o(n!). I am a beginner at this course and nead a head start. can anyone please help me solving this …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in o notation problem

    What's the definition of `o` that you learned? Do you understand that definition? What are your thoughts on how that definition may apply to `a^n = o(n!)`?
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Assigning a byearray to a void pointer

    void func(void * ptr) { bytearray temp(10); *((bytearray*) ptr ) = temp; } This code is not going ahead if the third line while executing while this coding is working …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Assigning a byearray to a void pointer

    What's `bytearray` and how and where is it defined? Unless you posted this in the wrong forum and this is actually C++ (and `bytearray` is a class that you defined …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Array of strings

    #include<cstdio> #include<string> #include "inventory.h" #include "node.h" #include<iostream> using namespace std ; int main (){ inventory*obj1=new inventory(); int size; int id,i; char A[100]; char S_string; cout<<"plz enter the size of the …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Array of strings

    First of all you need to include `string.h`, not `string`, to get the declaration of `strcmp` (or even better keep including `string`, use the string class and don't bother with …

The End.