-
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 … -
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 … -
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/ -
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 … -
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 … -
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 … -
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. … -
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 … -
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 … -
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 … -
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 -
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 … -
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 { … -
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. -
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 … -
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 … -
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. -
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 … -
Replied To a Post in Switch-case not functioning properly?
Please post a compilable and runnable piece of code that reproduces your problem. -
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 … -
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 … -
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 … -
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 … -
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 … -
Replied To a Post in Return 0
> Is that what you meant to write? Nope, removed the mistaken "not". -
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 || … -
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 … -
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 … -
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 … -
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 … -
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 … -
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 … -
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; } … -
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 … -
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 … -
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> … -
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] … -
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 … -
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 … -
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 … -
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 … -
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). … -
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 … -
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 … -
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 = … -
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. … -
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 … -
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 … -
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 … -
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.