10 More Discussions You Might Find Interesting
1. Programming
Dear all,
I am using C and ROOT for programming. And I need to incorporate following in my code.
char *fps=NULL;
int dec=0,sign=0;
float mean = h1->GetMean(1); //0.001298
fps= fcvt(mean,6 , &dec, &sign);
I need to provide this mean as const char to some other function to get... (8 Replies)
Discussion started by: emily
8 Replies
2. Programming
I am writing some code in C++ to print a message using fprintf
Here is an example
void pr_desc(
FILE* stream,
int shift,
const char* desc) {
const char* format="%*s\e;
fprintf(stream,format,shift,"",desc);
}
I call it using
const char* desc;
... (4 Replies)
Discussion started by: kristinu
4 Replies
3. Programming
Hi
In the following code, why the variable 'i' still retains the value 10 instead of 11? Why it is not possible to alter this variable's value?
int main() {
const int i = 10;
*(const_cast<int*>(&i)) = 11;
cout << i << endl; // Ans: 10
} (6 Replies)
Discussion started by: royalibrahim
6 Replies
4. Programming
Hi,
Can any one tell me why my following program is crashing?
#include <iostream>
using namespace std;
class CA {
public:
const static int i;
};
const int CA::i = 10;
int main() {
int* pi = const_cast<int*>(&CA::i);
*pi = 9;
cout << CA::i << endl;
} (6 Replies)
Discussion started by: royalibrahim
6 Replies
5. Homework & Coursework Questions
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies
6. Programming
Is it permitted to type-cast a member variable passed in as a parameter in a member const method ..
I am doing something like :
in a
return-type method () const {
variable other = long(member variable)
}
this other assigned variable is not updating and I wonder if type-casting in such... (1 Reply)
Discussion started by: shriyer123
1 Replies
7. Programming
Is it possible to have a non-const reference variable as an OPTIONAL/DEFAULT parameter to c++ function
ex
void read(string &data,int &type=0 /*or something*/) ;
so i will call
read(data);
//or
int type;
read(data,type);
printf("Type =%d",type);
I found one dirty workaround
... (2 Replies)
Discussion started by: johnbach
2 Replies
8. Red Hat
Hello everey one,
here i am attempting to compile a c++ project .it's throughing the following errors.
my machine details are as follows:
Linux chmclozr0119 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
errors:
=====
Generating... (0 Replies)
Discussion started by: mannam srinivas
0 Replies
9. Programming
hi,
what is the difference b/w char in C and C++.and give me the examples.
Thanks...
sarwan (3 Replies)
Discussion started by: sarwan
3 Replies
10. Programming
Can any one explain how the statement '2' in the following statements is a legal one.
int & ref = 3; // Illegal statement - Compiler error.
const int& ref=3 ; // Compile and executes properly.
Thanks in Advance,
Arun (1 Reply)
Discussion started by: arun.viswanath
1 Replies