• Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Type conversion from string to const char * problem

    > Even if you make abc global, it still doesn't work in Visual Studio 2015 Because your function is returning a *copy* of abc and that copy is a temporary …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Type conversion from string to const char * problem

    Hi, I am facing an issue in string to const char pointer conversion. I am doing stuff in the fun() but here i am just giving my example. Here it …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in java compilers, finding the first and follow

    This has (hopefully) been answered here: http://www.dreamincode.net/forums/topic/398067-first-and-the-follow-compilers/
  • Member Avatar for sepp2k
    sepp2k

    Began Watching java compilers, finding the first and follow

    hopefully soone can help me with this lol , this grammar im looking at is kinda tricy and i feel like theres something im missing. im trying to find the …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in How to create my own file extension?

    Note that using a different extension won't prevent people from opening the file in a text editor. It'll just stop a text editor from being the default application that will …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching How to create my own file extension?

    I am designing a software and want to save data in a txt file. but dont want the user to open them as txt file, only the app should do …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching BNF Grammar

    I know I should have try it first but I dont understand what is this asking about. My english is my very bad. Can you please telling in easy english. …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in BNF Grammar

    > <for loop> ::= for ( <expression> ; <expression>; <expression> ) <statement> All three expressions in a for-statement are optional and from C99 onwards the first one may be a …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Question About Comparable/compareTo

    Hello, I have a question about ascending order sorting using the Comparabe interface: When I add the keys of my Hash Map to a TreeSet object and implement the compareTo …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Question About Comparable/compareTo

    Using your first definition `account1.compareTo(account2)` will call `account2.name.compareTo(account1.name)` and using your second definition it will call `account1.name.compareTo(account2.name)`. So using the result of the comparisson will be the other way around …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching illeagal start of exprssion

    public class adding public class adding { public static void main(string[] args){ { int a=1; int b=2; sum c=a+b; system.out.println c;(sum c)-> } } help illegal start of expressions
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in illeagal start of exprssion

    This isn't what's causing your syntax error, but Java doesn't have a type named `sum` nor do you define one anywhere in your prorgram (unless you defined it in a …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Java Generics-Find Max Element in Array

    I am writing a program for extra practice from my book on finding the max element in array using Java Generics. My Code so far is: public class GenericMax { …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Java Generics-Find Max Element in Array

    The `>` operator is only defined for primitive types. To compare `Comparable` objects, use the `compateTo` method instead.
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in General Programming Question - How code is read !

    > Thus, the compiler doesn't need to parse or read the whole file, before generating output But here you're just saying that the compiler can start writing the .exe (or …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Difference b/w ++variable and variable++ in loop

    I have a little confusion in my mind. I know very well the difference between preincrement and postincrement, postdecrement and predecrement. But i wonder how do these operators work during …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Difference b/w ++variable and variable++ in loop

    There's only a difference when you use the return value of the increment for something. So the two loops are completely equivalent.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Switch-case not functioning properly?

    Hello guys! I'm working a project and it seems that there's something wrong with my switch-case. For example, in the user menu, the user can input the number 2 then …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Switch-case not functioning properly?

    Please post a compilable and runnable piece of code that reproduces your problem.
  • Member Avatar for sepp2k
    sepp2k

    Began Watching General Programming Question - How code is read !

    I have a question about programming/scripting in general, which I'm still driving over rocky terrian trying to learn. The compiler, regardless what it is; reads though code from top to …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in General Programming Question - How code is read !

    Any implementation will definitely *read* everything (well some languages have some kind of "stop here" token, which causes the impelementation to stop reading at that token, but in those case …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    If the shell is POSIX compliant, it will be able to correctly interpret what it gets back from the OS. So given that and given the fact that the OS …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    >if you want to go this way, you need to define carefully what this shell script language you're using does. Fair enough. I was assuming a POSIX compliant shell (or …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    Wait I totally confused myself. The way I originally wrote it was correct. > `your-program || echo "Error"` > So if your-program evaluates to zero, this will output "Error" on …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    > Is that what you meant to write? Nope, removed the mistaken "not".
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    No, it's not. The C standard says that if main returns 0, the program should indicate to the OS that it was successful. But if it did that `your-program || …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    > If by "false" you mean "was not successful", I disagree. By false I meant that it'd go into the `else` of an `if`, the alternative of an `||` or …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    > If a shell script is relying on the return value of a program, the person who wrote that shell script should read the documentation and learn what the returned …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Return 0

    int main() { int a=10; printf("%d",a); return 0; or return a; } # 1ts question:In the program Why you used 0 in return 0 ; and 2nd question : if …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Return 0

    > In the program Why you used 0 in return 0 ; The return value of main is the program's exit code. If it is 0, that means that the …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching explicit cast in c#

    assume latgeInt=2147483647 Debug.Log(largeInt); //2147483647 float largeFloat = largeInt; Debug.Log(largeFloat); ///2.147484E+09 int backAgain = (int)largeFloat; Debug.Log(backAgain); //-2147483648 *This part i did not get. I assume there was some data loss when …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in explicit cast in c#

    2147483647 is the largest number that an int can store. When you convert it to float, it becomes 2147483648.0 due to floating point accuracies. When you convert that back to …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching for loop

    public static boolean isEmpty(int grid[][]) { for (int r = 0; r < grid.length; r++) for (int c = 0; c < grid.length; c++) if (grid[r][c]==0) { return true; } …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in for loop

    Your question seems to be missing some words. Did you mean "After returning true, does the for loop continue?" If so, the answer is no. When the return statement is …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in char[] gives error in alpha-numeric input

    > but we can't access any character from char pointer with loop like str[0]. str[0] prints the whole string till last character. That's not true. `str[0]` will give you the …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching char[] gives error in alpha-numeric input

    Hi everyone, My program is crashing on taking input of alpha-numeric and store it in char[]. I don't know why, please anyone help ! sample input : C9H8O4MgOH #include <iostream> …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in char[] gives error in alpha-numeric input

    When you don't specify the size of an array, the size is inferred from the initializer. So when you write `int arr[] = {1,2,3}`, that's the same as `int arr[3] …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Cant find a syntax error?

    Hey guys, I've started building a program for college, everything was running really smooth and I've started to pick things up in the past couple days, but for the life …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Cant find a syntax error?

    Syntax errors come with a line and column number as well as some indiciation of what's missing (or what's there that shouldn't be). So to find a syntax error you …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching LOOP problem

    #include <iostream> using namespace std; main() { int matrix[2][2]; for (int i = 0; i<=2; i++) { for (int j = 0; j<=2; j++) { cout <<"Please Enter matrix "<<i<<"th …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in LOOP problem

    It'd have helped us if you had described in what way the code did not behave as expected, but your problem is that you access the matrix out of bounds …
  • Member Avatar for sepp2k
    sepp2k

    Gave Reputation to mike_2000_17 in Dynamic cast vs static_cast

    > this downcast is invalid and will throw an exception. Actually, it won't. Invalid downcasts only throw a `std::bad_cast` if you use references (because you can't have a null reference). …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Dynamic cast vs static_cast

    Oh, I seem to have missed a question earlier: > Please explain: why do we need to have base class' at least one virtual function? Why is it so? Technical …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Dynamic cast vs static_cast

    > Programmer *pProg = (Programmer *)&employee; A downcast is valid if the object to which the pointer points actually is of the type to which you cast. > Secondly, Can …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Dynamic cast vs static_cast

    Base *pb = dynamic_cast<Base*>(&d); This is an upcast. Using `dynamic_cast` here is pointless as the cast is always valid. You can and should just write it as `Base *pb = …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Dynamic cast vs static_cast

    I read many articles on Web regarding this. I am able to understand what static_cast does. I am not to properly understand why, and when we have to dynamic cast. …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Dynamic cast vs static_cast

    > I am not to properly understand why, and when we have to dynamic cast. Strictly speaking, you don't ever have to use `dynamic_cast`. You *can* use `dynamic_cast` when the …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Git system help

    > Can you tell me onw thing why we have to commit? To apply changes from the workspace to the repository. > I read somewhere that workspace is different from …
  • Member Avatar for sepp2k
    sepp2k

    Began Watching Git system help

    Hi, I am learning Git system these days. I have made a new folder in ubuntu and in terminal did this: 1. git init 2. then made a file testfile1.txt …
  • Member Avatar for sepp2k
    sepp2k

    Replied To a Post in Git system help

    If a file has never been added, it is untracked. Untracked files are not affected by anything you do with git (like switching branches). One way of looking at it …

The End.