Thanks a lot everyone .
-Gaurav
Type: Posts; User: agarwaga
Thanks a lot everyone .
-Gaurav
kerninghan ritchie
pg102 last paragraph
"Any pointer can be meainingfully compared for equality or inequality with zero. But the behavior is undefined for arithmetic or comparisons with pointers...
i want to check if pt1 and pt2 point to same instance (data in instances is not relevant to me).....
can i simply do pt1 == pt2
i have read that you can't compare two pointers unless they point...
I have two pointers pt1 and pt2 pointing to link list nodes.
I read that two pointers can not be compared (they can be only in case they point to member of same array) , then how do i check that...
how do you print all the permutations of a string when:
1)assume all characters are distinct .
2)can have duplicate characters
i know how to do it recursively:
example string is abc...
how will you multiply a positive number by 7 without using straight forward multiplication and addition.
best i could find out was
int func(int n){
int temp = n<<3; //multiply by 8
return...
take this function
/* this checks if t is at the end of s*/
int mystrend(char* s,char* t){
int l1 = strlen(s);
int l2 = strlen(t);
if(l2 > l1) return 0;
s = s + l1 - 1;
...
thanks a lot dave
-gaurav
I want to rotate right a number by n bits. I don't have the width of the word of the machine and i wan't to solve my problem without finding out the width.(one can always find out the width of a word...
When i write a c program using a c library function say malloc , is the machine code for the malloc (which includes system calls or similar calls) present in the executable ?
or does every OS has...
thanks a lot :D
#include <stdio.h>
void display(int* arr,int len){
int i;
for(i = 0; i < len; ++i){
printf("%d ",arr[i]);
printf("\n");
}
}
main()
{
#include <stdio.h>
void display(int* arr,int len){
int i;
for(i = 0; i < len; ++i){
printf("%d ",arr[i]);
printf("\n");
}
}
main()
{
main()
{
int a[] = { 2,4,6,8,10 };
int I = 0;
printf("%d ",I[a]);
printf("%d ",0[a]);
printf("%d ",1[a]);
printf("%d ",2[a]);
printf("%d ",3[a]);
}
it does compile (Borland C++ 5.5.1 for Win32) , leave the class mentioned above
even the code mentioned below compiles , although it doesn't produce the result i expected
...
My problem is with the array's length not being specified. Can it make sense in some case ?
Btw, how do you give the size of this array afterwards?
does this given class make sense, if yes where can it be useful ??
class A{
public:
int a[];
};
also change
template<class T>
void TestTT>::SetBalance()
{ balance = 100;
}
to
the change mentioned below should solve ur problem
catch(Test<float>::whoops) // <--- This is giving me a parse error
i am returning back to C++ after quite some time ...
I will suggest you use a vector of strings if the file is not too big
// reading a text file
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
i don't know abt the later half of ur code , but u can improve the first half quite a lot ..
#include <iostream.h>
#include <stdio.h>
using namespace std;
int main(){
char Command[128];...
i am using Borland C++ 5.5.1 for Win32
/*
the code below prints copy constructor called three times , i can trace 2 times , one at throw in myfunction and one at catch(A e) in main .... can somebody explain the third
*/
...
#include <iostream.h>
void main(){
int a = 1;
cout<< &a;
}
is the address output the actual physical memory address of the variable or some logical address.